Skip to content

Instantly share code, notes, and snippets.

@dnaber-de
Created January 24, 2012 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dnaber-de/1671196 to your computer and use it in GitHub Desktop.
Save dnaber-de/1671196 to your computer and use it in GitHub Desktop.
Relative Cursor position in an Element (using MooTools)
$( '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