I'm working on a responsive design on which I'd like to use two specific touch events, tap
and swipe
. Is it possible to import a single jQuery Mobile slice (i.e. jquery.mobile.events.js) or a piece of any other mobile-driven JavaScript framework, without importing the entire set of assets? I'm currently using jQuery, just so you know.
The touchstart event occurs when the user touches an element. Note: The touchstart event will only work on devices with a touch screen.
On a phone, mouse click doesn't exist. Instead, there are only touch events. This isn't entirely true, because some devices on some browsers for some elements will simulate a mouse click when a touch is made.
The touchmove event is used to execute a script when the user moves the finger across the screen. It works only on touch screen devices and triggers once for every movement and continues to trigger until the finger is released.
You can also just download the module Events.Touch from jQuery Mobile using their download builder http://jquerymobile.com/download-builder/
Just tick the option 'Touch', add the JavaScript file to your project so you can start listening to events such as:
ps: You must be using the jQuery library as jQuery mobile runs on top of it.
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