Drag & Drop Lists
Download

Drag & Drop Lists by Geoff Lankow is licensed under a Creative Commons Attribution 3.0 License.
This Javascript code can be used to rearrange the contents of one or more lists, using drag and drop:
- List item one
- List item two
- List item three
- List item four
- List item five
- List item six
- List item seven
- List item eight
- List item nine
- List item ten
- List item eleven
Installation is simple, just create a new DragDropList and add each list to it. They don't necessarily have to be HTML ULs or OLs, this code will work with just about any HTML elements.
var ddl = new DragDropList ();
ddl.listLayoutMode = "horizontal";
ddl.addList (document.getElementById ("list1"));
ddl.addList (document.getElementById ("list2"));
If your lists are laid out next to each other, set listLayoutMode to horizontal, or if they're above one another use vertical. Otherwise don't set it and the code will work out where to go using the power of maths.