# Sortable [![CircleCI](https://circleci.com/gh/SortableJS/Sortable.svg?style=svg)](https://circleci.com/gh/SortableJS/Sortable) [![DeepScan grade](https://deepscan.io/api/teams/3901/projects/5666/branches/43977/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=3901&pid=5666&bid=43977) [![](https://data.jsdelivr.com/v1/package/npm/sortablejs/badge)](https://www.jsdelivr.com/package/npm/sortablejs) [![npm](https://img.shields.io/npm/v/sortablejs.svg)](https://www.npmjs.com/package/sortablejs)
Sortable is a JavaScript library for reorderable drag-and-drop lists.
Demo: http://sortablejs.github.io/Sortable/
[<img width="250px" src="https://raw.githubusercontent.com/SortableJS/Sortable/HEAD/st/saucelabs.svg?sanitize=true">](https://saucelabs.com/)
## Features
* Supports touch devices and [modern](http://caniuse.com/#search=drag) browsers (including IE9)
* Can drag from one list to another or within the same list
* CSS animation when moving items
* Supports drag handles *and selectable text* (better than voidberg's html5sortable)
* Smart auto-scrolling
* Advanced swap detection
* Smooth animations
* [Multi-drag](https://github.com/SortableJS/Sortable/tree/master/plugins/MultiDrag) support
* Support for CSS transforms
* Built using native HTML5 drag and drop API
* Supports
* [Meteor](https://github.com/SortableJS/meteor-sortablejs)
* Angular
* [2.0+](https://github.com/SortableJS/angular-sortablejs)
* [1.*](https://github.com/SortableJS/angular-legacy-sortablejs)
* React
* [ES2015+](https://github.com/SortableJS/react-sortablejs)
* [Mixin](https://github.com/SortableJS/react-mixin-sortablejs)
* [Knockout](https://github.com/SortableJS/knockout-sortablejs)
* [Polymer](https://github.com/SortableJS/polymer-sortablejs)
* [Vue](https://github.com/SortableJS/Vue.Draggable)
* [Ember](https://github.com/SortableJS/ember-sortablejs)
* Supports any CSS library, e.g. [Bootstrap](#bs)
* Simple API
* Support for [plugins](#plugins)
* [CDN](#cdn)
* No jQuery required (but there is [support](https://github.com/SortableJS/jquery-sortablejs))
<br/>
### Articles
* [Dragging Multiple Items in Sortable](https://github.com/SortableJS/Sortable/wiki/Dragging-Multiple-Items-in-Sortable) (April 26, 2019)
* [Swap Thresholds and Direction](https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction) (December 2, 2018)
* [Sortable v1.0 — New capabilities](https://github.com/SortableJS/Sortable/wiki/Sortable-v1.0-—-New-capabilities/) (December 22, 2014)
* [Sorting with the help of HTML5 Drag'n'Drop API](https://github.com/SortableJS/Sortable/wiki/Sorting-with-the-help-of-HTML5-Drag'n'Drop-API/) (December 23, 2013)
<br/>
### Getting Started
Install with NPM:
```bash
$ npm install sortablejs --save
```
Install with Bower:
```bash
$ bower install --save sortablejs
```
Import into your project:
```js
// Default SortableJS
import Sortable from 'sortablejs';
// Core SortableJS (without default plugins)
import Sortable from 'sortablejs/modular/sortable.core.esm.js';
// Complete SortableJS (with all plugins)
import Sortable from 'sortablejs/modular/sortable.complete.esm.js';
```
Cherrypick plugins:
```js
// Cherrypick extra plugins
import Sortable, { MultiDrag, Swap } from 'sortablejs';
Sortable.mount(new MultiDrag(), new Swap());
// Cherrypick default plugins
import Sortable, { AutoScroll } from 'sortablejs/modular/sortable.core.esm.js';
Sortable.mount(new AutoScroll());
```
---
### Usage
```html
<ul id="items">
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ul>
```
```js
var el = document.getElementById('items');
var sortable = Sortable.create(el);
```
You can use any element for the list and its elements, not just `ul`/`li`. Here is an [example with `div`s](https://jsbin.com/visimub/edit?html,js,output).
---
### Options
```js
var sortable = new Sortable(el, {
group: "name", // or { name: "...", pull: [true, false, 'clone', array], put: [true, false, array] }
sort: true, // sorting inside list
delay: 0, // time in milliseconds to define when the sorting should start
delayOnTouchOnly: false, // only delay if user is using touch
touchStartThreshold: 0, // px, how many pixels the point should move before cancelling a delayed drag event
disabled: false, // Disables the sortable if set to true.
store: null, // @see Store
animation: 150, // ms, animation speed moving items when sorting, `0` — without animation
easing: "cubic-bezier(1, 0, 0, 1)", // Easing for animation. Defaults to null. See https://easings.net/ for examples.
handle: ".my-handle", // Drag handle selector within list items
filter: ".ignore-elements", // Selectors that do not lead to dragging (String or Function)
preventOnFilter: true, // Call `event.preventDefault()` when triggered `filter`
draggable: ".item", // Specifies which items inside the element should be draggable
dataIdAttr: 'data-id',
ghostClass: "sortable-ghost", // Class name for the drop placeholder
chosenClass: "sortable-chosen", // Class name for the chosen item
dragClass: "sortable-drag", // Class name for the dragging item
swapThreshold: 1, // Threshold of the swap zone
invertSwap: false, // Will always use inverted swap zone if set to true
invertedSwapThreshold: 1, // Threshold of the inverted swap zone (will be set to swapThreshold value by default)
direction: 'horizontal', // Direction of Sortable (will be detected automatically if not given)
forceFallback: false, // ignore the HTML5 DnD behaviour and force the fallback to kick in
fallbackClass: "sortable-fallback", // Class name for the cloned DOM Element when using forceFallback
fallbackOnBody: false, // Appends the cloned DOM Element into the Document's Body
fallbackTolerance: 0, // Specify in pixels how far the mouse should move before it's considered as a drag.
dragoverBubble: false,
removeCloneOnHide: true, // Remove the clone element when it is not showing, rather than just hiding it
emptyInsertThreshold: 5, // px, distance mouse must be from empty sortable to insert drag element into it
setData: function (/** DataTransfer */dataTransfer, /** HTMLElement*/dragEl) {
dataTransfer.setData('Text', dragEl.textContent); // `dataTransfer` object of HTML5 DragEvent
},
// Element is chosen
onChoose: function (/**Event*/evt) {
evt.oldIndex; // element index within parent
},
// Element is unchosen
onUnchoose: function(/**Event*/evt) {
// same properties as onEnd
},
// Element dragging started
onStart: function (/**Event*/evt) {
evt.oldIndex; // element index within parent
},
// Element dragging ended
onEnd: function (/**Event*/evt) {
var itemEl = evt.item; // dragged HTMLElement
evt.to; // target list
evt.from; // previous list
evt.oldIndex; // element's old index within old parent
evt.newIndex; // element's new index within new parent
evt.oldDraggableIndex; // element's old index within old parent, only counting draggable elements
evt.newDraggableIndex; // element's new index within new parent, only counting draggable elements
evt.clone // the clone element
evt.pullMode; // when item is in another sortable: `"clone"` if cloning, `true` if moving
},
// Element is dropped into the list from another list
onAdd: function (/**Event*/evt) {
// same properties as onEnd
},
// Changed sorting within list
onUpdate: function (/**Event*/evt) {
// same properties as onEnd
},
// Called by any change to the list (add / update / remove)
onSort: function (/**Event*/evt) {
// same properties as onEnd
},
// Element is removed from the list into another list
onRemove: function (/**Event*/evt) {
// same properties as onEnd
},
// Attempt to drag a filtered element
onFilter: function (/**Event*/evt) {
var itemEl = evt.item; // HTMLElement receiving the `mousedown|tapstart` event.
},
// Event when you move an item in the list or between lists
onMove: function
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【资源说明】 1.项目代码均经过功能验证ok,确保稳定可靠运行。欢迎下载食用体验! 2.主要针对各个计算机相关专业,包括计算机科学、信息安全、数据科学与大数据技术、人工智能、通信、物联网等领域的在校学生、专业教师、企业员工。 3.项目具有丰富的拓展空间,不仅可作为入门进阶,也可直接作为毕设、课程设计、大作业、初期项目立项演示等用途。 4.当然也鼓励大家基于此进行二次开发。在使用过程中,如有问题或建议,请及时沟通。 5.期待你能在项目中找到乐趣和灵感,也欢迎你的分享和反馈! 【项目介绍】 基于fastadmin框架开发的车辆维修派单系统源码(可绑定公众号,推送消息)附sql数据库+说明.zip 后台入口:/admin.php 账号:admin 密码:123456 。 前台入口:域名 。 微信配置:系统配置填写appid,appsecret,模板id不需要改。 运行前:公众号认证,开通模板消息,并且模板消息行业选择为 it/电子商务,然后运行一次 域名\admin.php\order\order\addall,就可自动绑定微信并推送消息
资源推荐
资源详情
资源评论
收起资源包目录
基于fastadmin框架开发的车辆维修派单系统源码(可绑定公众号,推送消息)附sql数据库+说明.zip (2000个子文件)
pimple.c 37KB
backend.min.css 378KB
frontend.min.css 307KB
bootstrap.css 143KB
bootstrap.css 141KB
fastadmin.css 132KB
main.css 124KB
bootstrap.min.css 122KB
bootstrap.min.css 119KB
bootstrap.min.css 118KB
fastadmin.min.css 114KB
layui.css 73KB
_all-skins.css 48KB
selectpage.css 40KB
font-awesome.css 37KB
style.css 34KB
style.css 34KB
style.css 31KB
style.css 31KB
font-awesome.min.css 30KB
style.min.css 29KB
font-awesome.min.css 28KB
style.min.css 27KB
bootstrap-theme.css 25KB
bootstrap-table-group-by.css 24KB
bootstrap-table-group-by.css 24KB
bootstrap-theme.min.css 23KB
backend.css 21KB
layer.css 15KB
layer.css 14KB
layer.css 14KB
frontend.css 11KB
layui.mobile.css 10KB
bootstrap-datetimepicker.css 9KB
daterangepicker.css 8KB
shCoreEclipse.css 8KB
bootstrap-datetimepicker.min.css 8KB
shCoreDjango.css 7KB
shCoreFadeToGrey.css 7KB
toastr.css 7KB
shCoreDefault.css 7KB
shCoreMidnight.css 7KB
shCoreRDark.css 7KB
laydate.css 7KB
shCoreEmacs.css 7KB
shCoreMDUltra.css 7KB
bootstrap-select.css 7KB
bootstrap-select.css 7KB
Jcrop.css 7KB
bootstrap-table.css 7KB
bootstrap-table.css 7KB
toastr.min.css 6KB
bootstrap-select.min.css 6KB
bootstrap-select.min.css 6KB
jquery.ui.plupload.css 6KB
layer.css 6KB
bootstrap-table.min.css 6KB
index.css 6KB
layer.css 5KB
shCore.css 5KB
Jcrop.min.css 5KB
custom.css 5KB
demos.css 5KB
theme.css 5KB
skin-white-light.css 5KB
slider.css 5KB
qunit.css 5KB
skin-blue-light.css 4KB
jquery.validator.css 4KB
skin-purple-light.css 4KB
skin-yellow-light.css 4KB
skin-green-light.css 4KB
skin-white.css 4KB
skin-red-light.css 4KB
jquery.plupload.queue.css 4KB
skin-blue.css 4KB
skin-yellow.css 4KB
skin-purple.css 4KB
skin-green.css 4KB
skin-red.css 3KB
style.css 3KB
style.css 3KB
city-picker.css 3KB
city-picker.css 3KB
shThemeEclipse.css 3KB
base.css 2KB
shThemeDjango.css 2KB
bootstrap-datetimepicker-standalone.css 2KB
shThemeFadeToGrey.css 2KB
shThemeVisualStudio.css 2KB
shThemeDefault.css 2KB
shThemeMidnight.css 2KB
shThemeRDark.css 2KB
shThemeEmacs.css 2KB
shThemeMDUltra.css 2KB
base.css 2KB
website.css 2KB
shThemeAppleScript.css 2KB
prettify.css 2KB
demo.css 1KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
.whl
- 粉丝: 3955
- 资源: 4904
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 石墨烯 钙钛矿太阳能电池COMSOL仿真:光电热耦合模型
- BoostPFC闭环CRM开关电源模型Matlab BoostPFC模型,闭环控制,CRM临界导通模式,ZCS零电流关断 开关电源PFC,适合入门学习使用,带参考文献 仿真模型使用MATLAB 2
- 基于TCP协议的分布式应用请求复制(TCPCopy)设计源码
- 双向clllc谐振变器基波分析法下电压增益与品质因数Q和电感比k的关系,用matlab做得文件,可以改不同的值,得到不同的曲线
- 基于Java与前端技术的MBTI职业性格测试系统设计源码
- 基于Vue框架的在线音乐系统设计源码
- 魔术轮胎公式验证 matlab与simulink联合仿真验证魔术轮胎模型,通过对比魔术轮胎公式计算的轮胎侧偏力与carsim输出的侧偏力来验证
- 基于Java开发的阿东技术顾问yeb_back001设计源码
- 基于鸿蒙系统的OpenGL图形编程学习设计源码
- 车辆二自由度动力学模型验证 matlab与simulink联合仿真车辆二自由度动力学模型验证,将相同的前轮转角和车速输入carsim和动力学模型,对比carsim和二自由度动力学模型输出的横摆角和车辆
- 基于PHP、HTML、CSS、JavaScript的通用知识竞赛小程序设计源码
- 车辆运动学模型验证 matlab与simulink联合仿真车辆运动学模型验证,将相同的前轮转角和车速输入carsim和运动学模型,对比carsim输出和运动学模型的输出
- 自动驾驶轨迹跟踪控制-纵向mpc横向lqr 轨迹和路径不同,注意是轨迹跟踪不是路径跟踪 模型可以提供前轮转向 后轮转向 四轮转向三种模型,多套模型打包有优惠 跟踪五次多项式道轨迹,纵向控制已经制作好
- 基于Java_SpringBoot的医院综合业务管理系统设计源码
- 上位机采用Labwindows CVI编写,下位机采用RTX64实时系统编写,上位机和下位机通过共享内存通讯,下位机控制周期是1ms,上位机保存的数据为TDMS格式,可以通过NI Diadem软件进行
- 基于Vue的HQ-ADMIN后台管理框架设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功