# 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
没有合适的资源?快使用搜索试试~ 我知道了~
小程序进销存源码 PHP网络版ERP进销存管理系统 账号admin 密码123456
共2002个文件
js:1156个
html:274个
md:260个
12 下载量 171 浏览量
2023-10-23
15:32:23
上传
评论
收藏 49.03MB ZIP 举报
温馨提示
小程序进销存源码 PHP网络版ERP进销存管理系统 1. 前端开发:uniapp 2. 后端开发:PHP 3. 数据库:MySql 账号admin 密码123456 功能介绍: 1、支持采购单录入、审核、入库、退货等采购过程中的记录追踪 2、支持销售、出库、销售审核、出库审核、退货等跟踪 3、支持产品出库、入库的数据导出 4、支持客户、仓库等管理 5、前端采用Bootstrap以及Bootstrap-table相结合实现自适应的效果、弹窗等 6、界面简单简洁
资源推荐
资源详情
资源评论
收起资源包目录
小程序进销存源码 PHP网络版ERP进销存管理系统
账号admin
密码123456 (2002个子文件)
bootstrap.css 149KB
main.css 129KB
bootstrap.min.css 119KB
iconfont.css 93KB
selectpage.css 41KB
font-awesome.css 39KB
style.css 35KB
style.css 35KB
style.css 32KB
style.css 32KB
font-awesome.min.css 30KB
style.min.css 29KB
style.min.css 27KB
bootstrap-theme.css 26KB
bootstrap-table-group-by.css 24KB
bootstrap-table-group-by.css 24KB
bootstrap-theme.min.css 23KB
layer.css 16KB
layer.css 14KB
bootstrap-datetimepicker.css 9KB
daterangepicker.css 8KB
toastr.css 8KB
bootstrap-select.css 8KB
bootstrap-select.css 8KB
bootstrap-datetimepicker.min.css 8KB
Jcrop.css 8KB
bootstrap-table.css 7KB
bootstrap-table.css 7KB
jquery.ui.plupload.css 7KB
toastr.min.css 6KB
bootstrap-select.min.css 6KB
bootstrap-select.min.css 6KB
layer.css 6KB
bootstrap-table.min.css 6KB
custom.css 5KB
demos.css 5KB
layer.css 5KB
Jcrop.min.css 5KB
slider.css 5KB
qunit.css 5KB
jquery.validator.css 5KB
jquery.plupload.queue.css 4KB
style.css 4KB
style.css 3KB
city-picker.css 3KB
city-picker.css 3KB
base.css 2KB
bootstrap-datetimepicker-standalone.css 2KB
base.css 2KB
website.css 2KB
prettify.css 2KB
demo.css 1KB
style.css 854B
bootstrap-table-reorder-rows.css 832B
bootstrap-table-reorder-rows.css 832B
prettify-1.0.css 790B
bootstrap-table-tree-column.css 582B
bootstrap-table-tree-column.css 582B
bootstrap-table-sticky-header.css 438B
bootstrap-table-sticky-header.css 438B
bootstrap-table-multiple-selection-row.css 322B
bootstrap-table-multiple-selection-row.css 322B
bootstrap-table-click-edit-row.css 307B
bootstrap-table-click-edit-row.css 307B
bootstrap-table-filter-control.css 202B
bootstrap-table-filter-control.css 202B
bootstrap-table-jumpto.css 155B
bootstrap-table-jumpto.css 155B
bootstrap-table-group-by.css 135B
bootstrap-table-group-by.css 135B
bootstrap-table-auto-refresh.css 49B
bootstrap-table-auto-refresh.css 49B
.DS_Store 6KB
.DS_Store 6KB
rail.html 57KB
scrollbar.html 57KB
index.html 44KB
height-width.html 35KB
multiple-elements.html 35KB
index.html 30KB
programmatic-scrolling.html 25KB
start-position.html 24KB
allow-page-scroll.html 24KB
mouse-wheel.html 24KB
disable-fade-out.html 24KB
index.html 18KB
panel.html 17KB
edit.html 16KB
index.html 16KB
add.html 15KB
add.html 15KB
add.html 15KB
demo.html 13KB
edit.html 13KB
index.html 13KB
chaining.html 13KB
edit.html 13KB
edit.html 12KB
index.html 11KB
install.html 11KB
共 2002 条
- 1
- 2
- 3
- 4
- 5
- 6
- 21
资源评论
mxs0523
- 粉丝: 63
- 资源: 22
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- HTML5实现好看的儿童学习教育网站源码.zip
- HTML5实现好看的儿童用品电商网页源码.zip
- HTML5实现好看的儿童用品公司网页源码.zip
- HTML5实现好看的耳机耳麦厂商网站源码.zip
- HTML5实现好看的二手车交易市场网站源码.zip
- HTML5实现好看的法律垂直招聘网站源码.zip
- HTML5实现好看的翻山越岭旅行公司网页源码.zip
- HTML5实现好看的房产中介公司网站源码.zip
- HTML5实现好看的房地产开发公司网站源码.zip
- HTML5实现好看的房地产公司简介网页源码.zip
- HTML5实现好看的房车自驾游网站源码.zip
- HTML5实现好看的房地产开发商网站源码.zip
- HTML5实现好看的房地产新楼盘门户网站源码.zip
- HTML5实现好看的房地产租房售房网页源码.zip
- HTML5实现好看的非洲贫困儿童公益网页源码.zip
- HTML5实现好看的非主流个人博客网站源码.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功