package
use native drag and drop APIs to provide sortable items
npm install nativesortableGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
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/
var list = document.getElementById("list");
nativesortable(list, {
change: onchange,
childClass: "sortable-child",
draggingClass: "sortable-dragging",
overClass: "sortable-over"
});bower install nativesortable
- or -
npm install nativesortableI 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
img and a tags)