javascript 触摸启动与点击。引擎盖下会发生什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9633297/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Touchstart vs Click. What happens under the hood?
提问by u635504
First, excuse me please, this is not a programming question, but I think it wont fit to Theoretical CS, and CS Non Programmingis still in private Beta.
首先,请原谅,这不是一个编程问题,但我认为它不适合理论 CS,而且CS 非编程仍处于私人测试阶段。
after updating my phonegap Applications to listen to
更新我的 phonegap 应用程序后收听
$(selector).bind("touchstart",function());
$(selector).bind("touchstart",function());
instead of
代替
$(selector).click(function());
$(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 documenton touchstart, but it doesnt provide any information.
(这里使用 jquery),并且性能显着提高,我想知道 touchstart 有什么不同,尽管它可能是专门为移动设备环境设计的。我在 touchstart 上查找了w3c 文档,但它没有提供任何信息。
if anyone has a link to further explanation or can explain how it works, I greatly appreciate it
如果有人有进一步解释的链接或可以解释它是如何工作的,我将不胜感激
回答by Kernel James
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.
在 iPhone 上,只要您的手指触摸屏幕,就会触发 touchstart 事件,而在您触摸屏幕并将手指从屏幕上抬起 300 毫秒后,点击事件会触发。300 毫秒的时间延迟是为了让 Safari 可以等待,看看您是否打算连续双击屏幕以模拟缩放手势。