Javascript / Jquery,禁用网页正文中任何位置的所有双击?
我已经为 Web 应用程序编写了很多 AJAX 代码,并且没有考虑双击某些内容可能导致的问题。我已经为敏感的 AJAX 调用实现了一个“inprogress”变量,这样用户双击就不会弄乱它,但我想知道是否有一种简单的方法可以禁用内部任何地方(任何元素中)的所有双击网页的整个主体,而不必为每个特定元素单独执行。
感谢您的任何建议
I already have a lot of AJAX code written for a web app and didn't take into account the problems that double clicks on some things can cause. I already implemented an "inprogress" variable for sensitive AJAX calls so that it won't be messed up by double clicking by the user but I am wondering if there is a simple way to just disable all double clicks anywhere (in any element) within the entire body of the web page rather than having to do it individually for each specific element.
Thanks for any advice
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试像这样疯狂的事情:
理论上,它会捕获任何元素上的双击事件,然后基本上不执行任何操作(取消默认操作)。
Try something crazy like this:
In theory, it would capture the double-click event on any element and then basically do nothing (cancels the default action).
应该处理它,但是可能有更好的解决方案。
Should handle it, however there is probably a better solution out there.
如果您没有将事件绑定到双击,则双击将不会执行任何操作。这是它自己的事件。
Click 和 DoubleClick 是不同的事件。
If you havn't bound events to double click, double click will do nothing. It is event of its own.
Click and DoubleClick are different events.