News for hackers. Stuff that matters.
Re:Ask HN: Current best practice for drag-and-drop? by couchand on Tuesday August 19, 2014 @03:50PM (#8199400)
Thanks for the support. Eventually I think this is the way we'll go. For the time being I'm putting up with dropping in jQuery UI, but I think my next big project will be a few React mixins for UI interactions like this.
Re:Ask HN: Current best practice for drag-and-drop? by callum85 on Tuesday August 19, 2014 @05:38PM (#8199967)
My comment earlier was a bit strong; there are obviously cases when you just need to get the job done, and if jQuery UI covers your use case with an acceptable perf hit then go with it.

If you want a halfway house, I've just remembered this little jQuery plugin, not well known at all, but it is the best thing available:

http://threedubmedia.com/code/event/drag

For me this plugin was a bridge between using DnD libraries and writing raw mouse listeners. It basically just fires off events at key points during a drag sequence, and it's up to you to update element styles to move them around... ie, you can't see anything physically happening on the page unless you update the DOM yourself (not difficult). It's basically sugar around mouse events to make them a lot less intimidating, eg, on each move it gives you the mouse position relative to wherever the drag started, so you don't have to keep track of this yourself.

Compared to any regular DnD library, it's better performing and miles more flexible. It's almost as good as doing it with raw mouse events. Look at the demos and view the code, they are impressive. It's old though. Hope it still works with modern jQuery.