Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/huanz/zepto.touch
- Owner: huanz
- Created: 2015-11-30T09:40:11.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-08T09:43:13.000Z (almost 9 years ago)
- Last Synced: 2024-11-14T09:12:02.012Z (4 days ago)
- Topics: jquery, jquery-touch-plugin, swipe, touch, touch-events, zepto, zepto-plugin
- Language: JavaScript
- Size: 15.6 KB
- Stars: 3
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
};