Skip to content

Sortable — is a minimalist JavaScript library for modern browsers and touch devices. No jQuery.

Notifications You must be signed in to change notification settings

tamara-cherevko/Sortable

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 = ui.detail;
	},

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

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

About

Sortable — is a minimalist JavaScript library for modern browsers and touch devices. No jQuery.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published