简体   繁体   English

在长按/点击平板电脑时触发Javascript事件

[英]Javascript event fired on long press/tap on tablets

I am developing a website using RWD priciples and it is supposed to self adjust and work in both desktop and in tablets, and eventually in Mobiles as well. 我正在使用RWD原则开发一个网站,它应该在台式机和平板电脑中进行自我调整和工作,最终也可以在移动设备中使用。

I know in android development we can catch a long tap event and do some actions. 我知道在android开发中我们可以捕获一个长时间的事件并做一些动作。

But my question is that, is it possible to do it in HTML/HTML5 and javascript? 但我的问题是,是否可以在HTML / HTML5和JavaScript中执行此操作?

Basically looking for a predefined event which gets fired on long press on html elements. 基本上寻找一个预定义的事件,在长按html元素时会被触发。

I have gone through This and understood all the alternatives suggested. 我已经完成了这一点,并了解了所有建议的替代方案。 Looking if anything new has been introduced in HTML5. 查看HTML5中是否引入了任何新内容。
Thanks 谢谢

Might check out pointer.js from Mozilla. 可以从Mozilla中查看pointer.js Apparently somewhat standardizes the touch/ mouse events into a single event type. 显然,将触摸/鼠标事件标准化为单个事件类型。 Probably better than using timeouts, I'd imagine. 我想,可能比使用超时更好。

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

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