draggable-list

2.2.5 • Public • Published

draggable-list

Build Status

This is a component, built using d3, that will take a html ul and make it sortable using drag and drop.

Code Example

As an object that emits move events

var List = require('draggable-list')
  , d3 = require('d3')

var list = new List(document.querySelector('.draggable-list')) // Pass in a node that should
                                                               // have dnd to sort
list.on('move', function (node, newIndex, prevIndex) {
  console.log(arguments)
})

Or using d3 conventions

var draggable = require('draggable-list')
  , d3 = require('d3')

d3.selectAll('.draggable-list')
  .call(draggable)

Elements can set a class of draggable-list-nodrag to prevent dnd operations on that element.

Elements can set a class of draggable-list-lock so the list item index is always maintained.

Installation

$ npm install draggable-list

Tests

$ npm test

License

ISC

Dependents (0)

Package Sidebar

Install

npm i draggable-list

Weekly Downloads

3

Version

2.2.5

License

ISC

Unpacked Size

28.7 kB

Total Files

9

Last publish

Collaborators

  • koopa