Reputation: 1825
I have a draggable element that I am dragging into one of various droppable areas. However, I want the draggable item to always return to its original position, even if it was dragged into a droppable area (the droppable areas handle their own events when the draggable is dropped onto them). Is there a way to do this?
I notice that returning true or false from the stop() function in draggable affects both its return to original position as well as whether or not it triggers the droppable's drop() function. Is there a way to handle these separately?
Upvotes: 2
Views: 7439
Reputation: 2683
It's kinda a hack but when you have
$('yourelement').draggable({revert:true});
will revert it no matter if it drops or not. And it will still fire the drop event on the droppable element.
Upvotes: 14
Reputation: 709
Do you want your droppables to accept other elements? If not, you can set the 'accept' option of the droppable to 'false'
$('.foo').droppable('option','accept',false);
Upvotes: 0