Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leocaseiro/664fbb4ea4841467eb22 to your computer and use it in GitHub Desktop.
Save leocaseiro/664fbb4ea4841467eb22 to your computer and use it in GitHub Desktop.
jQuery UI Sortable Remove Dragged Item out
$( "#sortable" ).sortable({
forcePlaceholderSize: true,
tolerance: 'pointer',
cursor: 'pointer',
over: function () {
removeIntent = false;
},
out: function () {
removeIntent = true;
},
beforeStop: function (event, ui) {
if(removeIntent === true) {
ui.item.hide();
if (confirm('Are you sure want to remove this photo?')) {
ui.item.remove();
} else {
ui.item.show();
}
}
}
});
$( "#sortable" ).disableSelection();
@l7960261
Copy link

Awesome ! This way is helpful for me.

Thank you.

@ViniciusRio
Copy link

Awesome ! This way is helpful for me.

Thank you.

@wuduhren
Copy link

Thanks!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment