1. Home
  2. Javascript
  3. Mouse position
#javascript#mouse

You can capture X and Y mouse position using clientY and clientX properties.

window.addEventListener("mousemove", function(e){
    console.log("Mouse position: Y " + e.clientY, ", X " + e.clientY, );
});
copy
Full Javascript cheatsheet
Sitemap Git repository