Answers for "get mouse location relative to its element"

3

js mouse position relative to element

// e = Mouse click event.
let rect = e.target.getBoundingClientRect();
let x = e.clientX - rect.left; //x position within the element.
let y = e.clientY - rect.top;  //y position within the element.
Posted by: Guest on December-21-2020

Code answers related to "get mouse location relative to its element"

Code answers related to "Javascript"

Browse Popular Code Answers by Language