Posted By

vestimir on 03/02/11


Tagged

jquery sortable jQueryUI


Versions (?)

Remove jQueryUI list element by drag-out


 / Published in: jQuery
 

URL: http://stackoverflow.com/questions/3377161/jquery-sortable-delete-current-item-by-drag-out/4400097#4400097

Sortable, doesn't support natively drag-to-remove action, so I found this little hack on stackoverflow.

  1. $(ELEMENT).sortable({
  2. receive: function(event, ui) {
  3. sortableIn = 1;
  4. },
  5. over: function(e, ui) { sortableIn = 1; },
  6. out: function(e, ui) { sortableIn = 0; },
  7. beforeStop: function(e, ui) {
  8. if (sortableIn == 0) {
  9. ui.item.remove();
  10. }
  11. }
  12. });

Report this snippet  

You need to login to post a comment.