diff --git a/README.md b/README.md index 3013526..78de6e2 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,13 @@ -I failed to mainttain this project in the past two years. -For an updated version see [voidberg's fork](https://github.com/voidberg/html5sortable) - -HTML5 Sortable jQuery Plugin +Bootstrap HTML5 Sortable jQuery Plugin ============================ -**[Demos & Documentation](http://farhadi.ir/projects/html5sortable)** +**[Demos & Documentation](http://psfpro.ru/html5sortable/index.html)** Features -------- * Less than 1KB (minified and gzipped). * Built using native HTML5 drag and drop API. * Supports both list and grid style layouts. -* Similar API and behaviour to jquery-ui sortable plugin. * Works in IE 5.5+, Firefox 3.5+, Chrome 3+, Safari 3+ and, Opera 12+. Usage @@ -23,6 +19,14 @@ $('.sortable').sortable(); ``` Use `.sortable-dragging` and `.sortable-placeholder` CSS selectors to change the styles of a dragging item and its placeholder respectively. +Use `placeholderClass` option to create sortable lists with additional class for placeholder: + +``` javascript +$('.sortable').sortable({ + placeholderClass: 'customPlaceholderClass' +}); +``` + Use `sortupdate` event if you want to do something when the order changes (e.g. storing the new order): ``` javascript @@ -80,21 +84,6 @@ To enable a disabled sortable: $('.sortable').sortable('enable'); ``` -The API is compatible with jquery-ui. So you can use jquery-ui as a polyfill in older browsers: - -``` javascript -yepnope({ - test: Modernizr.draganddrop, - yep: 'jquery.sortable.js', - nope: 'jquery-ui.min.js', - complete: function() { - $('.sortable').sortable().bind('sortupdate', function(e, ui) { - //Store the new order. - } - } -}); -``` - License ------- Released under the MIT license. diff --git a/index.html b/index.html index 0b650db..09aedca 100644 --- a/index.html +++ b/index.html @@ -1,175 +1,288 @@
-| # | +First Name | +Last Name | +Username | +
|---|---|---|---|
| 1 | +Mark | +Otto | +@mdo | +
| 2 | +Jacob | +Thornton | +@fat | +
| 3 | +Larry the Bird | +||
+ Download it from here. + Then use it like this: +
<ul class="sortable">
+ <li>Item 1
+ <li>Item 2
+ <li>Item 3
+ <li>Item 4
+ </ul>
+ <script src="jquery.sortable.js"></script>
+ <script>
+ $('.sortable').sortable();
+</script>
+
+
+ Use .sortable-dragging and .sortable-placeholder selectors to change the styles of a dragging item and its placeholder respectively.
+
+ Use placeholderClass option to create sortable lists with additional class for placeholder.
+
$('.sortable').sortable({
+ placeholderClass: 'customPlaceholderClass'
+});
+
+
+ Use sortupdate event if you want to do something when the order changes (e.g. storing the new order):
+
$('.sortable').sortable().bind('sortupdate', function() {
+ //Triggered when the user stopped sorting and the DOM position has changed.
+});
+
+
+ Use items option to specifiy which items inside the element should be sortable.
+
$('.sortable').sortable({
+ items: ':not(.disabled)'
+});
+
+
+ Use handle option to create sortable lists with handles:
+
$('.sortable').sortable({
+ handle: '.handle'
+});
+
+
+ Use connectWith option to create connected lists:
+
$('#sortable1, #sortable2').sortable({
+ connectWith: '.connected'
+});
+
+ + To remove the sortable functionality completely: +
$('.sortable').sortable('destroy');
+
+ + To disable the sortable temporarily: +
$('.sortable').sortable('disable');
+
+ + To enable a disabled sortable: +
$('.sortable').sortable('enable');
+
+ + Home +
+