Question

I am trying to add a delay between when the user drags and drops the div, and when the div reverts back.

revertDuration controls the speed of the div reverting back, I want a delay before this happens.

I am quite unfamiliar with jQuery, spending too much time trying to work this out and it seems like it should be pretty straight-forward.

Here the jQuery: $( "#draggable" ).draggable({ revert: true , revertDuration: 1000 });

and here is a fiddle http://jsfiddle.net/YxBP9/54/

thank you very much

-e

Was it helpful?

Solution

Is not simple as it seems.

The only way I found is to use a function in the revert option and than use jQuery delay to wait your time, dealy was build up for other purposes (queue and animation) but in this case is working fine.

Code:

$("#draggable").draggable({
    revert: function () {
        $(this).delay(5000);
        return true
    },
    revertDuration: 1000
});

Demo: http://jsfiddle.net/IrvinDominin/qGTF5/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top