Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know the dragging element is over which element?

I have a problem with jQuery Drag&Drop. I have a draggable element and lots of dropTarget so I just want to know when I am dragging, my dragging element is over which element?

Btw, Firefox provides event.originalTarget that points an DOM Element but it is equal to "undefined" in Google Chrome.

Any suggestion?

Thanks.

like image 608
Fatih Acet Avatar asked Nov 22 '10 09:11

Fatih Acet


1 Answers

Check out the over event on your droppables.

$('#droppableid').droppable({
    over: function(event, ui) {
        log('You are over item with id ' + this.id);
    }
});

Example here.

like image 172
sje397 Avatar answered Oct 27 '22 01:10

sje397