简体   繁体   English

使用touchstart或mousedown?

[英]Use touchstart or mousedown?

我编写了mousedown / mouseup事件监听器,并且可以在我的android手机上使用,所以如果我只需要简单的触摸,就不需要为所有手机编写touchstart函数吗?

If your logic is working, why would you want to change it / add more event handlers? 如果您的逻辑有效,那么为什么要更改它/添加更多事件处理程序?

I recommend reading this documentation to determine for yourself whether or not you should use these specific handlers. 我建议您阅读本文档,以确定自己是否应该使用这些特定的处理程序。 Although it is iOS documentation, it gives you a good feel of how the mobile events are handled. 尽管它是iOS文档,但它使您对移动事件的处理方式有了很好的了解。

More ontopic : 更多主题

If you just need a simple touch event, it seems to me that a 'click' event listener would be enough. 如果您只需要一个简单的触摸事件,在我看来,“单击”事件监听器就足够了。 If you want to do any scrolling / mouse(touch?) specific stuff, again: read that documentation . 如果您要进行滚动/鼠标触摸操作,请再次阅读该文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM