SortableJS / Sortable

Reorderable drag-and-drop lists for modern browsers and touch devices. No jQuery or framework required.
https://sortablejs.github.io/Sortable/
MIT License
29.59k stars 3.7k forks source link

How do I get the element that the mouse is over? #1120

Open mattduple opened 7 years ago

mattduple commented 7 years ago

For instance

If I drag 1 over 2 how do I get the 2 element while the mouse is over it? sort of like an over element function or something?

I am trying to implement something like http://www.jqueryscript.net/demo/jQuery-Plugin-To-Sort-Nested-Lists-Using-Drag-Drop-nestedSortable/.

So I would need to get the element that the item is over and append a new sortable list to it. Not sure how to implement it yet.

I think adding this functionality would help a lot with creating nested sortable lists.

aintJoshinya commented 7 years ago

you can get the Id of the element you are over while dragging by using the onMove event. evt.related.id will contain the Id of the item you are currently over. this will work with multiple lists as well.