Reputation: 682
I would like to detect when a sortable item has been dragged out of the container (or has been dropped outside of the container) so I can call a function if it has been selected and dropped inside the same container class.
$(".container").sortable({
connectWith: ".button",
tolerance: "pointer",
stop: function(event, ui) {
if(!not-dragged-outside-of-container) {
// a function here
}
}
});
$(".button").sortable({
connectWith: ".container",
tolerance: "pointer"
});
Upvotes: 1
Views: 1778
Reputation: 159
Use the receive and remove callbacks. The item is in the ui object passed as the second argument: http://api.jqueryui.com/sortable/#event-remove
Upvotes: 1