Execute revert event at draggable element when dropped it
-
04-07-2021 - |
質問
I have a problem with jQueryUI and the draggable/droppable options.
What I want to accomplished is this:
1) Drag an element into another one 2) Once the element its there, revert the draggable element to its initial state (and do some other stuff)
I can revert the object to its initial state by doing this:
revert : function(event, ui) {
B(this).data("draggable").originalPosition = {
top: 0,
left: 0
};
return !event;
}
But I want to revert the element even and when it is dragged into the correct place...
EDIT
I have tried this:
B('#template').find('section').droppable({
drop : function(e, ui) {
ui.draggable.triggerHandler('revert');
}
}
But it is not working... I have also tried to get the option and execute it, but it is also not working.
解決
If you always want to revert, just return true
in your revert function
所属していません StackOverflow