JavaScript - 如何停止鼠标移动 [英] JavaScript - How to stop mouse movement

查看:81
本文介绍了JavaScript - 如何停止鼠标移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有jQuery可能。

如何使用JavaScript禁用/停止鼠标移动?

怎么做:如果要移动鼠标,让我们说,左边的位置< 300 ,禁用ouse移动以防止进一步朝这个方向移动。

What to do: If the mouse is being moved to, let's say, position left < 300, disable ouse movement to prevent further moving into this direction.

这可能吗?

推荐答案

Javascript可以读取鼠标位置但不能设置它。鼠标光标属性存在于HTML文档对象模型之外,因此超出了Javascript的范围。但是捕获了鼠标事件,因此也允许读取/事件修改(鼠标悬停,鼠标悬停,鼠标移出,鼠标单击,dblclick)。

Javascript can read mouse position but not set it. The mouse cursor properties exist outside the HTML Document Object Model and thus are beyond the reach of Javascript. Mouse events however are captured and thus readable / event modification also permissible (mouse hover, mouse over, mouse out, mouse click, dblclick).

这篇关于JavaScript - 如何停止鼠标移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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