Dragula
lastmod 2022-03-24created 2022-03-237 edits
Drag and drop so simple it hurts
Inspiration
- Have you ever wanted a drag-and-drop library that just works?
- That doesn't just depend on bloated frameworks, that has great support?
- That actually understands where to place the elements when they are dropped?
- That doesn't need you to do a zillion things to get it to work?
- Well, so did I!
Features
- Super easy to set up.
-
No unnecessary dependencies.<- turns out it does have some... - Figures out sort order on its own
- Provides visual feedback with a shadow where the item would be dropped.
- Touch events!
- Seamlessly handles clicks without any configuration
Adding containers dynamically
Troubleshooting
When styles break while dragging
While dragging, a DOM element that displays the mirrored Element is added automatically. This thing is the root of all evil. Its default is document.body, and the cause is that the CSS style path breaks when the DOM position changes.
Just assign an appropriate Element to mirrorContainer in the constructor's options.
See also
See also
Favorite site
Pages that link here