Answers for "js get mouse event position relative to 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 "js get mouse event position relative to element"

Code answers related to "Javascript"

Browse Popular Code Answers by Language