Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery UI droppable 'drop' event to wait for revert
    primarykey
    data
    text
    <p>I am developing some simple drag-drop interactions with jQueryUI. Under some conditions, I would like the dragged item to go back to its original place (<a href="http://api.jqueryui.com/draggable/#option-revert" rel="nofollow">revert</a>) and then shake. I placed the <em>shake</em> in the <a href="http://api.jqueryui.com/droppable/#event-drop" rel="nofollow">drop event</a> of the droppable object, but it doesn't seem to wait for the revert to be finished. </p> <p>What's worse, sometimes it shakes <em>before</em> starting to revert to the original position, other times it shakes <em>after</em> the full revert has been done, and other times the shake gets caught up in the middle. It's not consistent.</p> <p>Is there any way to execute the <a href="http://api.jqueryui.com/droppable/#event-drop" rel="nofollow">drop</a> event of the droppable object <strong>after</strong> the draggable has completed its <a href="http://api.jqueryui.com/draggable/#option-revert" rel="nofollow">revert</a>?</p> <p><em>See this <strong>JSFiddle</strong> for an example: <a href="http://jsfiddle.net/sbQUE/" rel="nofollow">http://jsfiddle.net/sbQUE/</a></em></p> <p>In other words, if I set up the droppable as follows:</p> <pre><code>this.$el.droppable({ drop: someFunction }); </code></pre> <p>...the executed function is:</p> <pre><code>someFunction: function(ev, el){ $(el.draggable).effect('shake'); } </code></pre> <p>... and the draggable object that will fall on the droppable is set up like:</p> <pre><code>this.$el.draggable({ revert: true, revertDuration: 0 // or any number for that matter }); </code></pre> <p>How can I make sure the "someFunction" callback will be executed after the draggable is back in its original place thanks to the revert option? </p> <p><strong>Note:</strong> I tried looking for some sort of after revert callback or event but it doesn't exist (at least not in jQueryUI's documentation).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload