I ask if a Phonegap application is able to recognize swipeLeft and SwipeRight related events in Javascript.
Phonegap doesn't give you anymore touch events than you otherwise get with a normal mobile website. I.e. it's just wrapping a UIWebView (on iOS) or whatever the equivalent is on the other platforms.
Touch events in mobile browsers include touchstart
, touchend
, touchmove
, etc.
There aren't any fancy swipe events, or double-tap events, or anything like that natively implemented in mobile browsers.
But you can simulate those more complicated events by using javascript in conjunction with the stock touchstart
, touchend
events etc.
Luckily you don't need to bother writing those events yourself because nearly every mobile framework has done that for you. Other people have mentioned some libraries that handle touch events.
Myself, I tend to use jQuery Mobile which has swipeleft
and swiperight
events, as well as others.
http://jquerymobile.com/demos/1.2.0/docs/api/events.html
You don't even have to use the full jQuery Mobile framework if you don't want to. You can just include their touch event handlers if you want.
We use quo.js. It`s a lightweight framework to handle multi touch events and more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With