问题
I'm simply looking for a listener that will detect the swipe of a finger on a touch device.
For example;
if (swipe.direction == 'left' ) {
function();
}
回答1:
With jQueryMobile you can use several events, such as swipe
, or even swipeleft
, swiperight
, tap
, etc.
http://jquerymobile.com/test/docs/api/events.html
回答2:
You can use this jquery plugin
http://www.netcu.de/jquery-touchwipe-iphone-ipad-library
回答3:
A much nicer plugin for handling swipes ( if that's all you want ) is Touch Swipe.
I found the touchwipe to be pretty rubbish, and I always find jQueryMobile way to heavy when all you want is this functionality.
https://github.com/mattbryson/TouchSwipe-Jquery-Plugin
来源:https://stackoverflow.com/questions/10603157/detecting-iphone-swipe-with-jquery