Reputation: 5773
This is more of a conceptual question. After reading about Jquery Mobile, it got me thinking about how one would implement touch events like "tap" or "rub" using plain javascript. Since Jquery Mobile is built on javascript, does that mean the Jquery team is able to add custom events to vanilla javascript like ontap
or ondrag
?
This sums up my thought process:
Upvotes: 1
Views: 3232
Reputation: 150070
Not sure what your question is, and your point 2 seems to disagree with your point 3, but anyway...
Touch events are supported by at least some browsers and devices:
https://developer.mozilla.org/en/DOM/Touch_events
http://www.quirksmode.org/mobile/advisoryTouch.html
Upvotes: 1
Reputation: 8166
Some mobile browsers are able to fire events related to the interaction with a touch screen. Mobile Safari (don't know about other mobile browser but things shouldn't change much) for example has some custom events like touchstart
, touchmove
or touchend
That's how jQuery mobile and other libraries are able to handle this kind of events. If you want to dig deeper into a simple "real-world" implementation of one of this event you can have a look at the source code of this library, which handles the 'swipe' event.
https://github.com/cubiq/SwipeView/blob/master/src/swipeview.js
Upvotes: 2