Search code examples
jqueryjquery-uijquery-ui-draggablejquery-ui-droppable

How to remove animation on revert of jQuery UI draggable?


I tried Googling and couldn't find this, but I imagine it is a fairly simple task. I am trying to get rid of the revert animation (N.B. I want to keep the revert action, just want to remove the animation of it reverting) when you drop from the left side to the right side in this example : http://jsfiddle.net/2fsVZ/

Here is the long and short of what I am looking for:

Below is the JavaScript I am working with - how do I tell it to not animate the revert?

  $( ".before .left-side>div" ).draggable({ revert: true});

Solution

  • You just need to set the revertDuration to 0.

    $( ".before .left-side>div" ).draggable({
        revert: true,
        revertDuration: 0
    });
    

    http://jsfiddle.net/2fsVZ/2/

    http://docs.jquery.com/UI/Draggable#option-revertDuration