简体   繁体   English

使用Jquery鼠标事件来检测鼠标是否已连接

[英]using Jquery mouse events to detect if mouse is connected

I'm trying to detect whether a pointing device is being used on the page. 我正在尝试检测页面上是否正在使用定位设备。 $(document).on('mouseover') is being used to trigger a global variable, with the idea that any click before this happens signifies that a pointing device is not connected. $(document).on('mouseover')用于触发全局变量,其想法是在此之前发生的任何单击都表明未连接定点设备。 Unfortunately, mousedown or pointerdown are triggering the mouseover BEFORE I have a chance to set a false value. 不幸的是,在我有机会设置错误值之前,mousedown或pointerdown会触发鼠标悬停。 Is there a way to catch the click before the mouseover fires? 有没有办法在鼠标悬停触发前捕获点击? Is there something I can test for when the mouseover fires that will tell if the mousedown is also fired? 当鼠标悬停触发时,是否可以测试一下是否可以触发mousedown?

I don't think your approach is accurate, you won't be able to catch mouseover before mousedown, think about it... it's not natural that it happen that way. 我不认为您的方法是正确的,您将无法在鼠标按下之前捕捉鼠标悬停,想一想……这是不自然的。 What are you actually trying to change in your web? 您实际上是在尝试更改网络中的什么?

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

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