Skip to content

Instantly share code, notes, and snippets.

@didasy
Created June 26, 2014 02:19
Show Gist options
  • Save didasy/ec2713b285335b54425d to your computer and use it in GitHub Desktop.
Save didasy/ec2713b285335b54425d to your computer and use it in GitHub Desktop.
To track a mouse every x seconds
var mouse = { x : 0, y : 0 };
document.addEventListener('mousemove', function (e) {
mouse.x = e.clientX || e.pageX;
mouse.y = e.clientY || e.pageY;
})
var track = function () {
console.log(document.elementFromPoint(mouse.x, mouse.y));
setTimeout(track, 3000);
}
track();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment