Alo
Alo

Reputation: 5

jQuery UI: Get the droppable index which the draggable is in on DRAG

I'm making a jigsaw puzzle in HTML. There's a table which has empty spaces and below the table there are pieces which fit exactly into the empty spaces.

So I know how to get the draggable and droppable element on drop and how do get the draggable element on drag. But how do I get the droppable element in which the draggable element currently resides on drag event. Also if a draggable element isn't inside a droppable element it shouldn't break the code.

http://altement.ee/overflow/ click on on a button to start the puzzle too see what I have made. I need to know in which droppable element it is in right now to know if it is in a correct spot already or not.

Upvotes: 0

Views: 394

Answers (1)

T J
T J

Reputation: 43156

You can use over

Triggered when an accepted draggable is dragged over the droppable

If that doesn't workout for some reason, try elementFromPoint.

Here's an answer that does it.

Upvotes: 1

Related Questions