1.0.3 • Published 8 years ago

zepto.touch v1.0.3

Weekly downloads
29
License
MIT
Repository
github
Last release
8 years ago

zepto.touch npm package

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
};
1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago