Detecting iPhone Swipe with jQuery
14,628
Solution 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
Solution 2
You can use this jquery plugin
http://www.netcu.de/jquery-touchwipe-iphone-ipad-library
Solution 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
Author by
Antonio Moore
Updated on July 03, 2022Comments
-
Antonio Moore almost 2 years
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(); }
-
Antonio Moore about 12 yearsI tried using that but it started adding DIV elements to my page. I found another little plugin that I modified to work with watewrwheel carousel.
-
Janak Nirmal about 12 yearsThan you should post your answer detailing about that plugin and accept that so that other members can have benefit of your research. Well of course if you don't mind posting answer, please consider this as request.
-
Heath almost 12 yearsGreat little script! Although it's written a little strangely I very much prefer this to jQuery Mobile, since jQuery Mobile provides a ton of bloat and modifies the DOM automatically, even if you don't want it to.
-
Trip over 11 yearsThe
swipe
method in jQueryMobile does not return a swipe direction. In fact, I don't believe it can register and up/down swipe either. -
Edmund Sulzanok over 10 yearsWorks nice on PC, but I think it overrides .on("click") event on iPhone :(
-
Vasanthan.R.P about 9 yearsEven it is an Iphone related question and the answer is perfect for Iphone just to let people know that it is not working on Android Tabs
-
Alex McManns over 8 yearsIs it compatible with scroll?? In my case, if I set this events, loosing scrolling on touchscreen device like iPad!