clemos / nativesortable

Use native drag and drop APIs to provide sortable items. No dependancies.

Home Page:http://bgrins.github.com/nativesortable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

An implementation of HTML5 Drag and Drop API to provide a sortable list of items.

No external dependancies.

See demo here: http://bgrins.github.com/nativesortable/

Usage

var list = document.getElementByID("list");
nativesortable(list, { change: onchange });

Package Management

bower install nativesortable
- or -
npm install nativesortable

Extra CSS

I would also recommend adding the following CSS:

[draggable] {
  -moz-user-select: none;
  -khtml-user-select: none;
  -webkit-user-select: none;
  user-select: none;
}
[draggable] * {
  -moz-user-drag: none;
  -khtml-user-drag: none;
  -webkit-user-drag: none;
  user-drag: none;
}

This makes sure that

  • Text does not get highlighted while dragging
  • That native draggable elements (like img and a tags)

About

Use native drag and drop APIs to provide sortable items. No dependancies.

http://bgrins.github.com/nativesortable/

License:MIT License


Languages

Language:JavaScript 94.7%Language:CSS 5.3%