improved makeMagicList documentation
This commit is contained in:
parent
63122eb428
commit
dc0837bfee
|
@ -1,5 +1,6 @@
|
|||
/**
|
||||
* Creates a "magic" reorderable list from `container`.
|
||||
* Creates a reorderable list from any `container` and viable list item selector.
|
||||
*
|
||||
* This function is absolute magic and I love it
|
||||
*
|
||||
* Example:
|
||||
|
@ -29,6 +30,8 @@ export function makeMagicList(container, itemSelector, callback) {
|
|||
item.draggable = true;
|
||||
item.addEventListener("dragstart", () => { item.classList.add("moving") });
|
||||
item.addEventListener("dragend", () => { item.classList.remove("moving") });
|
||||
|
||||
// dragging on inputs should take priority
|
||||
item.querySelectorAll("input").forEach(el => {
|
||||
el.addEventListener("mousedown", () => { item.draggable = false });
|
||||
el.addEventListener("mouseup", () => { item.draggable = true });
|
||||
|
|
Loading…
Reference in a new issue