No jQuery possible.
How to disable / stop mouse movement with JavaScript?
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.
Is that possible?
No jQuery possible.
How to disable / stop mouse movement with JavaScript?
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.
Is that possible?
Share Improve this question asked Nov 16, 2012 at 11:06 ShlomoShlomo 3,9908 gold badges52 silver badges82 bronze badges 5 |3 Answers
Reset to default 11The Pointer Lock API might be what you're looking for
https://developer.mozilla.org/en-US/docs/API/Pointer_Lock_API
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).
You cannot do this with JavaScript and I dare say you never will be able to.
If you need to do this for some kind of game element, for example, I recommend that you place a page-element under the mouse and prevent the page-element from moving outside of the bounds even if the mouse does.
left < 300
using* {cursor: none;}
- disable is not possible – Grijesh Chauhan Commented Nov 16, 2012 at 11:09