双击即可触发单击 [英] Single click triggered on a double click

查看:106
本文介绍了双击即可触发单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

当检测到双击事件时需要取消点击/鼠标事件

我试图让一个HTML对象在加倍时表现不同点击事件发生。

I am trying to get a HTML object to behave differently when a single or double click event happens.

目前我的工作示例 http://jsfiddle.net/9vvEG/ 双击即触发单击,我希望我的代码专门监听预先配置的事件。的 即。如果双击忽略单击,反之亦然。

Currently with my working example http://jsfiddle.net/9vvEG/ the single click is triggered on the double click, I wish for my code to listen exclusively for the event pre-configured. i.e. if double clicked ignore single click and vice versa.

目前尚无成功,但如果点击上面的示例链接,则可以看到正在进行的错误。

No success as of yet, but if you click my example link above you can see the error in progress.

推荐答案

我认为你必须注意使用setTimeout两次点击之间的时间。在这里找一个解决方案:

I think you have to note the time between two clicks using setTimeout. Look a solution here:

  • Need to cancel click/mouseup events when double-click event detected

这也可以帮到你:

  • Javascript with jQuery: Click and double click on same element, different effect, one disables the other

这篇关于双击即可触发单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆