Reputation: 1825
I have a droppable with over(), out(), and drop() functions, which I want to behave differently if divs of class A and divs of class B are dropped on it. Let's say that the droppable should turn yellow if class A is hovered over it, and red if class B hovers over it. How can I do this?
Upvotes: 0
Views: 600
Reputation: 2189
the over
, out
, and drop
callbacks each take parameters of (event, ui)
. ui.draggable
is the element that was dragged onto the droppable. So you could do:
drop: function(event, ui) {
if (ui.draggable.hasClass('classA') {
}
}
Be sure to check out the jQuery UI Documention
Upvotes: 2