Retrieve the current position of the mouse cursor as an object literal in the form { x: xPos, y: yPos }.

Returns: An object literal in form { x: xPos, y: yPos }
  • evt, required: A valid Javascript event object (generally obtained through an event function handler) which is used to determine the mouse cursor position.

// assume console.log(..) is available to log arbitrary data to some console...

g('body').addEvent('mousemove', function(e)
	var mousePos = Gimme.Screen.getMousePosition(e);
	console.log('Mouse currently at: ' + mousePos.x + ', ' + mousePos.y);

Last edited Jan 10, 2008 at 6:04 AM by sstchur, version 1


No comments yet.