Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
285 views
in Technique[技术] by (71.8m points)

javascript - Touchstart vs Click. What happens under the hood?

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...