You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
RubaXa 3aac111143 * fixed touch & 'empty list' 11 years ago
st + effects 11 years ago
.gitignore + effects 11 years ago
Gruntfile.js + v0.1.0 11 years ago
README.md - CustomEvents; * evt.detail -> evt.item 11 years ago
Sortable.js * fixed touch & 'empty list' 11 years ago
Sortable.min.js * fixed touch & 'empty list' 11 years ago
index.html * retina 11 years ago
package.json * fixed touch & 'empty list' 11 years ago

README.md

Sortable

Features

  • Support touch devices
  • Built using native HTML5 drag and drop API
  • Simple API
  • Lightweight, 2KB gzipped
  • No jQuery

Usage

<ul id="items">
	<li>item 1</li>
	<li>item 2</li>
	<li>item 3</li>
</ul>
new Sortable(items);

Options

new Sortable(elem, {
	group: "name",
	handle: ".my-handle", // Restricts sort start click/touch to the specified element
	draggable: ".item",   // Specifies which items inside the element should be sortable
	ghostClass: "sortable-ghost",

	onAdd: function (evt){
		var itemEl = evt.item;
	},

	onUpdate: function (evt){
		var itemEl = evt.item; // the current dragged HTMLElement
	},

	onRemove: function (evt){
		var itemEl = evt.item;
	}
});