Jquery sortable dragged onto garbage container

I have a problem with a sortable, draggable item when I drop it on a trash can. The code is in this jsfiddle. http://jsfiddle.net/queeg/sRAmW/1/

It is very simple to reproduce the problem in jsfiddle:

  • drag "bread" into sortableA "The field" sortableA "expands to allow the item to fit.

  • drag “bread” to “Trash Can” The garbage can expand to accept the item, then the item disappears.

  • drag "bread" from "sortableA" to "Trash can" The problem will show itself. The garbage container does NOT expand, and the item moves to another location before it disappears.

+5
source share
3 answers

A possible solution would be to remove it position: absolutefrom the draggable if you drop it onto the trash:

var element = ui.draggable.css('position', '');

Demo

When using elements, #sortableXthey apply this css rule, but do not go directly from one of the two lists.

+4
source

The challenge $('#sortable, #sortable2').droppable();seems to do the trick. See here .

+2
source
+1

All Articles