24

First, excuse me please, this is not a programming question, but I think it wont fit to Theoretical CS, and CS Non Programming is still in private Beta.

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

Community
  • 1
  • 1
最白目
  • 3,505
  • 6
  • 59
  • 114
  • I think `touchstart` is similar to `mousedown`, so the event will be fired quicker. – alex Mar 09 '12 at 11:30
  • alex, thanks for the idea. I tested mousedown in my application, but the performance is similar to .click. – 最白目 Mar 09 '12 at 11:35

1 Answers1

42

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.

Anthony
  • 13,434
  • 14
  • 60
  • 80
Kernel James
  • 3,752
  • 25
  • 32