Presnus
Presnus

Reputation: 733

Sortable over event get current droppable

When using the over event, how can you get the current droppable? With the current droppable I mean the container hovering over for the moment.

Here is my code to make things clear:

$('#widgets-available, #sidebar-drop, #content-drop, #footer-drop').sortable({
    start: function(event, ui) {
        item = ui.item;
        newList = oldList = ui.item.parent().parent();
    },
    over: function(event, ui) {          
        //Get Current droppable??
    }
}).disableSelection();

});

Upvotes: 3

Views: 2333

Answers (2)

David Espino
David Espino

Reputation: 2187

... or you could use the properties from the event directly instead of doing a find:

   over: function(event) { 
      var myDroppable = event.target; //this is element where it's being dropped 
      var mySortable = event.toElement; //this is the "handle" element that fired the sort event in the first place.
}

Hope this works

Upvotes: 2

Haider
Haider

Reputation: 615

by using 'this' in the event something like the following

over: function(event, ui) {          
        $(this).find('.numdrag').size(); // give the count of elements with class .numdrag in the drop area 
    }

Upvotes: 2

Related Questions