Skip to content

a sortable plugin depends on zepto, supported by mobile & pc

Notifications You must be signed in to change notification settings

fwon/zepto-sortable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sortable(UI) Zepto.js Plugin

Demos

!!SUPPORT FOR MOBILE!!

This plugin uses Touch events and MouseEvent, so it can work both in mobile & pc.

Features

use delegate event, can add item dynamically, add callback event

  • 2KB (minified).
  • Built using native Touch events (can i use) and MouseEvent (can i use) .
  • Supports list with vertical and horizontal (not support grid style layouts yet).
  • Class control for move.
  • Can add item dynamically, which means you don't have to initial all items at first.

Usage

Use sortable method to create a sortable list:

<ul id="sortable">
    <li class="cont color1">Item 0</li>
    <li class="cont color2">Item 1</li>
    <li class="cont color3">Item 2</li>
    <li class="cont color4">Item 3</li>
    <li class="cont color5">Item 4</li>
    <li class="cont color6">Item 5</li>
</ul>
$('#sortable').sortable({
    orient: 'vertical',
    itemClassName: 'cont', //default 'cont'
    afterSort: function(){}
});

or

$('#sortable').sortable({
    orient: 'horizontal',
    itemClassName: 'cont', //default 'cont'
    afterSort: function(){}
});

To Do

  • Add drop animations with CSS3.
  • Support grid layout sortable.
  • Test in IE older browser.
  • Sort items automatically with animation.
  • ...

License

(The MIT License)

Copyright (c) 2016 Feng Wang(fwon) fengw1325@gmail.com

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 sortable plugin depends on zepto, supported by mobile & pc

Resources

Stars

Watchers

Forks

Packages

No packages published