JQuery UI Draggable & Droppable "Revert" and "Out" conflict -
i trying make multiple items draggable can dragged 1 droppable. if dropped outside of droppable revert. of code works except 1 bug:
user drags item droppable. drags out (executes out function) fails drop in droppable (revert happens, drag goes previous droppable). has happened droppable can accept drag (since drag left, executing out) while drag never left due revert.
i have been trying resolve several of hours , have gone through api. tried have callback function revert due confusion on how retrieve draggable's droppable, stuck.
//revert if not dragged draggable. $( "[id|=drag]" ).draggable({ revert: 'invalid', revertduration: 350 }); $( ".dropzone" ).droppable({ drop: function(ev,ui) { $(this).droppable('option', 'accept', ui.draggable); //only accept current drag. }, out: function(ev, ui) { $(this).droppable('option', 'accept', '[id|=drag]');//now can accept drag. } });
jsfiddle: http://jsfiddle.net/tg6cj/
Comments
Post a Comment