Reputation: 363
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.
Upvotes: 0
Views: 879
Reputation: 3545
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
Upvotes: 1