Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/huanz/zepto.touch

a zepto/jquery touch plugin
https://github.com/huanz/zepto.touch

jquery jquery-touch-plugin swipe touch touch-events zepto zepto-plugin

Last synced: about 5 hours ago
JSON representation

a zepto/jquery touch plugin

Awesome Lists containing this project

README

        

# zepto.touch [![npm package](https://img.shields.io/npm/v/zepto.touch.svg?style=flat-square)](https://www.npmjs.com/package/zepto.touch)

a zepto/jquery touch events plugin, it provides touch events like `tap`,`doubleTap`,`longTap`,`swipe`,`swipeLeft`,`swipeRight`,`swipeUp`,`swipeDown`.

# installation

use npm:

npm install zepto.touch

use bower:

bower install zepto.touch

# usage

the api is the same as zepto/jquery events, but it also provides setting method, you must write the setting method `$.fn.touch` before the touch events, eg:

$('ul').touch({
swipeMove: function (e, direction, distance, duration) {
console.log(e, direction, distance, duration);
}
}).on('swipe', 'li', function (e, direction) {
console.log(e, direction);
}).on('tap.test', function (e) {
console.log('tap.test');
}).on('tap', function (e) {
console.log('tap');
$(this).off('tap.test');
});

# options

$.fn.touch.defaults = {
fingers: 1,
threshold: 75,
longTapThreshold: 500,
doubleTapThreshold: 200,
excludedElements: 'label, button, input, select, textarea, .noTouch',
pageScroll: true,
swipeMove: null
};