javascriptcordova

Touchstart vs Click. What happens under the hood?


After updating my phonegap Applications to listen to

$(selector).bind("touchstart",function());

instead of

$(selector).click(function());

(here with jquery),and the performance improved remarkably, I want to know what touchstart does different, despite of the fact that it is probably designed especially for mobile devices environments. I looked up the w3c document on touchstart, but it doesnt provide any information.

if anyone has a link to further explanation or can explain how it works, I greatly appreciate it


Solution

  • On the iPhone the touchstart event fires as soon as your finger touches the screen, whereas the click event fires 300 ms after you touch the screen and lift you finger off the screen. The 300 ms time delay is so that Safari can wait to see if you intend to double tap the screen in succession to simulate the zoom gesture.