0

it's possible to stop mouse movement in window and allow only in certain box ?

for example, i have a div with width: 200px and height: 200px, to allow only in this div to move mouse.

Thank you.

vaneayoung
  • 353
  • 1
  • 4
  • 22
  • No - [http://stackoverflow.com/questions/13415345/javascript-how-to-stop-mouse-movement](http://stackoverflow.com/questions/13415345/javascript-how-to-stop-mouse-movement) – lshettyl Mar 27 '15 at 12:32
  • Possible duplicate of [Keep mouse inside a div](https://stackoverflow.com/questions/5730433/keep-mouse-inside-a-div) – Liam Jul 11 '17 at 15:05

1 Answers1

1

Javascript can read mouse position but not set it. What I would do for that kind of things is place an element under the mouse and prevent the page element from moving outside of the bounds even.

Also I have seen this link in stackoverflow, maybe it can help you

https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API

gon250
  • 3,405
  • 6
  • 44
  • 75