Created
June 2, 2015 05:52
-
-
Save Trshant/f4221c5563647f5f2b7f to your computer and use it in GitHub Desktop.
This will get the mouse position in javascript.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var position = {}; | |
document.addEventListener('mousemove', function(e){ | |
position = { x: e.clientX, y: e.clientY } // for browser window WRT | |
position = { x: e.pageX, y: e.pageY } // for page WRT | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment