Skip to content

Instantly share code, notes, and snippets.

@travismillerweb
Created April 17, 2014 16:44
Show Gist options
  • Save travismillerweb/10997109 to your computer and use it in GitHub Desktop.
Save travismillerweb/10997109 to your computer and use it in GitHub Desktop.
JS - Log Mouse Coordinates
/*
Neat Script that allows you to log mouse coordinates ever 3 seconds. Had to use th track down an image mapping bug.
Reference Link: http://stackoverflow.com/questions/6726409/getting-mouse-position-every-3-seconds
*/
var m_pos_x,m_pos_y;
window.onmousemove = function(e) { m_pos_x = e.pageX;m_pos_y = e.pageY; }
setInterval(function() { console.log("x= " + m_pos_x + "y = " + m_pos_y); },3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment