Search code examples
jqueryjquery-uijquery-ui-draggablejquery-ui-droppable

Move item from current place to when another item is dropped in its place


A small question hopefully with a simple answer, I am using jQuery draggable and droppable to place items into a Container. Using the below code for the drop.

$("#container").droppable({
        drop: function(event, ui) {
            //Do something to the element dropped
        }
    });

I want to move already added item from its place when another item is dropped in its place like a dock does.is there any way to do that?? Please refer http://blog.hedgeequities.com/ for understanding what I am trying to achieve.. In the reference site drag and drop the widgets present in the left side.


Solution

  • You might wanna try using jQuery sortable. It auto-adjusts when you drop on a sortable element.