Reputation: 283
I want to set the position of something relative to the current position of the mouse.
Is there a way that I can get the current position of the mouse without needing to constantly track where it is?
Ideally can I use the window
property to find it?
Upvotes: 0
Views: 44
Reputation: 36
Any way to track mouse position you have to use an event listener. if you have to do some different actions while tracking continuously would create issues like freezing.
To avoid these kinds of issues, we have two techniques
check out this link https://codeburst.io/throttling-and-debouncing-in-javascript-b01cad5c8edf
Upvotes: 1