MouseMove Event

Table of Contents

About

mousemove is an event that occurs when the pointing device is moved while it is over an element.

The onmousemove attribute may be used with most elements.

It permits to track the mouse location.

Demo

function onMouseMove(e){
  console.log(new Date().toLocaleString()+": Position: x: "+e.x+ ", y:"+ e.y);
}
let debouncedMouseMove = debounce(onMouseMove, 500);
document.addEventListener('mousemove', debouncedMouseMove);
  • The output: Move your mouse above the console region and stops it

Powered by ComboStrap