My Problem: The sortable event out: fires when I drag something in the list or when I sort the list. But I only want to start the function when I drag an item out.
My code
$(document).ready(function ust() { $('#div1').sortable({ out: function(event, ui) { $('#nfo').append('OUT<br />'); } }); });
Working example http://jsfiddle.net/FrbW8/22/
Use beforeStop to intercept the item and remove it:
receive: function(e, ui) { sortableIn = 1; }, over: function(e, ui) { sortableIn = 1; }, out: function(e, ui) { sortableIn = 0; }, beforeStop: function(e, ui) { if (sortableIn == 0) { ui.item.remove(); } }
(I originally found this in the Google, but can no longer find the link. So, I apologize for not referencing the source.)
This is the default behaviour of the out callback. See this jquery ui trac ticket
I really do not agree with the 'logical' behaviour notion.
"However, note that the "out" callback will still be triggered if you drag into a list and then release the mouse (but not if you're not over the list). This is logical behaviour and happens for normal sortables as well."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With