这是indexloc提供的服务,不要输入任何密码
Skip to content

Sortable — is a JavaScript library for reorderable drag-and-drop lists on modern browsers and touch devices. No jQuery required. Supports Meteor, AngularJS, React, Polymer, Vue, Knockout and any CSS library, e.g. Bootstrap.

Notifications You must be signed in to change notification settings

sbarski/Sortable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 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 = evt.item;
	},

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

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

About

Sortable — is a JavaScript library for reorderable drag-and-drop lists on modern browsers and touch devices. No jQuery required. Supports Meteor, AngularJS, React, Polymer, Vue, Knockout and any CSS library, e.g. Bootstrap.

Resources

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 77.2%
  • HTML 17.9%
  • CSS 4.9%