├── README.md
├── bower.json
├── index.html
├── jquery.sortable.js
└── jquery.sortable.min.js
/README.md:
--------------------------------------------------------------------------------
1 | DEPRECATION NOTICE
2 | ------------------
3 | This project is not mantained anymore. I recommend using [RubaXa's Sortable](https://github.com/RubaXa/Sortable) or [voidberg's fork](https://github.com/voidberg/html5sortable) instead.
4 |
5 | HTML5 Sortable jQuery Plugin
6 | ============================
7 |
8 | **[Demos & Documentation](http://farhadi.ir/projects/html5sortable)**
9 |
10 | Features
11 | --------
12 | * Less than 1KB (minified and gzipped).
13 | * Built using native HTML5 drag and drop API.
14 | * Supports both list and grid style layouts.
15 | * Similar API and behaviour to jquery-ui sortable plugin.
16 | * Works in IE 5.5+, Firefox 3.5+, Chrome 3+, Safari 3+ and, Opera 12+.
17 |
18 | Usage
19 | -----
20 | Use `sortable` method to create a sortable list:
21 |
22 | ``` javascript
23 | $('.sortable').sortable();
24 | ```
25 | Use `.sortable-dragging` and `.sortable-placeholder` CSS selectors to change the styles of a dragging item and its placeholder respectively.
26 |
27 | Use `sortupdate` event if you want to do something when the order changes (e.g. storing the new order):
28 |
29 | ``` javascript
30 | $('.sortable').sortable().bind('sortupdate', function(e, ui) {
31 | //ui.item contains the current dragged element.
32 | //Triggered when the user stopped sorting and the DOM position has changed.
33 | });
34 | ```
35 |
36 | Use `items` option to specifiy which items inside the element should be sortable:
37 |
38 | ``` javascript
39 | $('.sortable').sortable({
40 | items: ':not(.disabled)'
41 | });
42 | ```
43 | Use `handle` option to restrict drag start to the specified element:
44 |
45 | ``` javascript
46 | $('.sortable').sortable({
47 | handle: 'h2'
48 | });
49 | ```
50 | Setting `forcePlaceholderSize` option to true, forces the placeholder to have a height:
51 |
52 | ``` javascript
53 | $('.sortable').sortable({
54 | forcePlaceholderSize: true
55 | });
56 | ```
57 |
58 | Use `connectWith` option to create connected lists:
59 |
60 | ``` javascript
61 | $('#sortable1, #sortable2').sortable({
62 | connectWith: '.connected'
63 | });
64 | ```
65 |
66 | To remove the sortable functionality completely:
67 |
68 | ``` javascript
69 | $('.sortable').sortable('destroy');
70 | ```
71 |
72 | To disable the sortable temporarily:
73 |
74 | ``` javascript
75 | $('.sortable').sortable('disable');
76 | ```
77 |
78 | To enable a disabled sortable:
79 |
80 | ``` javascript
81 | $('.sortable').sortable('enable');
82 | ```
83 |
84 | The API is compatible with jquery-ui. So you can use jquery-ui as a polyfill in older browsers:
85 |
86 | ``` javascript
87 | yepnope({
88 | test: Modernizr.draganddrop,
89 | yep: 'jquery.sortable.js',
90 | nope: 'jquery-ui.min.js',
91 | complete: function() {
92 | $('.sortable').sortable().bind('sortupdate', function(e, ui) {
93 | //Store the new order.
94 | }
95 | }
96 | });
97 | ```
98 |
99 | License
100 | -------
101 | Released under the MIT license.
102 |
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "html5sortable",
3 | "version": "0.0.1",
4 | "homepage": "http://farhadi.ir/projects/html5sortable/",
5 | "authors": [
6 | "Ali Farhadi "
7 | ],
8 | "description": "Lightweight jQuery plugin to create sortable lists and grids using native HTML5 drag and drop API.",
9 | "main": "./jquery.sortable.js",
10 | "keywords": [
11 | "html5",
12 | "sortable",
13 | "jquery"
14 | ],
15 | "license": "MIT",
16 | "ignore": [
17 | "**/.*",
18 | "node_modules",
19 | "bower_components",
20 | "test",
21 | "tests"
22 | ],
23 | "dependencies": {
24 | "jquery": ">= 1.9.1"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | HTML5 Sortable jQuery Plugin
5 |
78 |
79 |
80 |
81 |
82 |
83 | HTML5 Sortable jQuery Plugin
84 |
85 |
86 | Features
87 |
88 | - Less than 1KB (minified).
89 |
- Built using native HTML5 drag and drop API.
90 | - Supports both list and grid style layouts.
91 | - Similar API and behaviour to jquery-ui sortable plugin.
92 | - Works in IE 5.5+, Firefox 3.5+, Chrome 3+, Safari 3+ and, Opera 12+.
93 |
94 |
95 |
96 | Sortable List
97 |
98 | - Item 1
99 | - Item 2
100 | - Item 3
101 | - Item 4
102 | - Item 5
103 | - Item 6
104 |
105 |
106 |
107 | Sortable Grid
108 |
109 | - Item 1
110 | - Item 2
111 | - Item 3
112 | - Item 4
113 | - Item 5
114 | - Item 6
115 |
116 |
117 |
118 | Exclude Items
119 |
120 | - Item 1
121 | - Item 2
122 | - Item 3
123 | - Item 4
124 | - Item 5
125 | - Item 6
126 |
127 |
128 |
129 | Sortable List With Handles
130 |
131 | - :: Item 1
132 | - :: Item 2
133 | - :: Item 3
134 | - :: Item 4
135 | - :: Item 5
136 | - :: Item 6
137 |
138 |
139 |
140 | Connected Sortable Lists
141 |
142 | - Item 1
143 | - Item 2
144 | - Item 3
145 | - Item 4
146 | - Item 5
147 | - Item 6
148 |
149 |
150 | - Item 1
151 | - Item 2
152 | - Item 3
153 | - Item 4
154 | - Item 5
155 | - Item 6
156 |
157 |
158 |
159 |
160 |
161 |
175 |
176 |