append on drop and revert
I have something similar to this:
$('.item').draggable({
helper: 'original',
revert: true,
});
$('dock').droppable({
accept: '.item',
tolerance: 'touch',
drop: function(ev, ui) {
$(ui.draggable.element).appendTo(this);
}
});
It didn't work as I expected it because the revert is trying to get
the item back to its original place even when it is dropped
successfully. I know I'm doing something wrong, I want the item to
revert to its original place when the drop fails ie: when it is
dropped outside the droppable.
As a second question:I'm dragging elements from one droppable to
another and I noticed that drop function is called twice for every
successfully drop. One call for the source droppable and the second
for the destination. Is that what it's supposed to do?
Thanks