- Notifications
You must be signed in to change notification settings - Fork55
A jQuery binding for SortableJS
SortableJS/jquery-sortablejs
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A jQuery binding for SortableJS
Demo:https://jsbin.com/nopixes/edit?html,js,console,output (credit to@laflier)
Install package:
npm i -D jquery-sortablejsImport into project:
import'jquery-sortablejs';
<scriptsrc="https://cdn.jsdelivr.net/npm/jquery-sortablejs@latest/jquery-sortable.js"></script>
// Without options:$('#my-list').sortable();// With options:$('#my-list').sortable({// SortableJS options go here// See: (https://github.com/SortableJS/Sortable#options)handle:'.handle',invertSwap:true,// . . .})
$('#my-list').sortable();varmySortableList=$('#my-list').sortable('widget');
Call.sortable() with the first argument as the option name and the second as the option value
// Get an optionvarisDisabled=$('#my-list').sortable('disabled');// Set an option$('#my-list').sortable('disabled',!isDisabled);
Pass'destroy' argument into.sortable()
// Destroy Sortable$('#my-list').sortable('destroy');
Pass the name of the function as string into.sortable(), followed by any arguments
// Sortable toArrayvarorder=$('#my-list').sortable('toArray');
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
About
A jQuery binding for SortableJS
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.