Methods |
---|
UI Actions
functions that enable more complex UI interaction
- Source:
Methods
(static) draggable(parentContainerId, onEnabled, onStartDrag, onEndDrag)
Makes children in a parent draggable. These children might contain other elements you want to
prevent the dragging on: such children need 'non-draggable' class
(at least one between the dragged item and the child in hierarchy)
Parameters:
Name | Type | Description |
---|---|---|
parentContainerId |
parent ID that keeps elements for which dragging will be enabled | |
onEnabled |
called for each child upon initialization, the element node is passed as argument | |
onStartDrag |
called before the dragging starts, the param is the event of the drag, returns true if the dragging should really start, false if not | |
onEndDrag |
called when the element is dropped at some position, the param is the event of the drag the dom node that triggered the change: event.target |
- Source:
Returns:
function to call for any other elements manually, note! these should be also direct children of
parentContainerId (i.e. adding more dynamically later).
note: use 'non-draggable' on inner content to prevent it from triggering the dragging
note: dragged item is always assigned 'drag-sort-active' class
note: events are attached to DOM tree, not the structure
- content changes in DOM involving your nodes destroys events;
hint: use node.dataset.<> API to store and retrieve values within items