I'm trying to get some of my libraries to work with touch devices, but it's hard for me to find ways how they are supported and how they work.
Basically, there are 5 touch events , but there seems to be consensus among mobile browsers only in the touchstart (duh) event. I created fiddle as a test case.
I tested this on my galactic note with Android 4 on board, but you can also check the connection with the desktop browser.
The goal is to try to figure out how to handle cranes, double cranes and long bends. Nothing unusual.
Basically, this is what happens:
Active Android browser does not trigger touch events. It just tries to simulate mouse clicks with taps by firing mousedown , mouseup and click events in sequence, but double taps simply increase and decrease the page.
Chrome for Android fires a touchstart event when a finger touches the screen. If it is released fast enough, it fires mousedown , mouseup , touchend and finally click events.
In the case of a long touch after about half a second, it fires mousedown and mouseup , and touchend when raising a finger without a click event at the end.
If you move your finger, it fires the touchmove event several times, then it fires the touchcancel event, and nothing happens after that, even with the touchend event touchend you raise your finger.
Double-clicking calls the zoom in / out function, but on an event, it twice combines a combination of touchstart - touchevent , and mouse events are not triggered.
Firefox for Android correctly fires the touchstart event, and in the case of short-term mousedown , mouseup , touchend and click touchend afterwards.
In the case of a long press, it fires the mousedown , mouseup and finally touchend . This is the same for Chrome for these things.
But if you move your finger if the touchmove fire touchmove constantly (as expected), but it does not fire the touchmove event when the finger leaves the element using the event listener and does not touchcancel when the finger leaves the browser view window.
For double taps, it behaves exactly like Chrome.
Opera Mobile does the same in Chrome and Firefox for a short press, but in the case of a long press, it activates some kind of sharing function, which I really want to disable. If you move your finger or double-tap, it will behave just like Firefox.
Chrome beta works the usual way for short-lived taps, but in the case of long taps, it no longer triggers the mouseup event, just touchstart , and then mousedown after half a second, then touchend when the finger is raised. When the finger moves, it now behaves like Firefox and Opera Mobile.
In the case of double taps, it does not trigger touch events when zooming, but only when zooming.
The beta version of Chrome shows the strangest behavior, but I can’t complain, as this is a beta version.
Question : Is there an easy way to search for short taps, long taps and double taps in the most common touch device browsers?
Too bad that I cannot test it on iOS devices using Safari or IE for Windows Phone 7 / Phone 8 / RT, but if some of you can, your feedback will be greatly appreciated.