Created
January 24, 2012 17:08
-
-
Save dnaber-de/1671196 to your computer and use it in GitHub Desktop.
Relative Cursor position in an Element (using MooTools)
This file contains 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
$( 'foo' ).addEvent( | |
'mousemove', | |
function( event ) { | |
var pos = this.getPosition( ); | |
var relPos = {}; | |
relPos.x = event.page.x - pos.x; | |
relPos.y = event.page.y - pos.y; | |
console.log( relPos ); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment