Return to Snippet

Revision: 21524
at December 15, 2009 09:51 by adambundy


Initial Code
function rPosition(elementID, mouseX, mouseY) {
  var offset = $('#'+elementID).offset();
  var x = mouseX - offset.left;
  var y = mouseY - offset.top;

  return {'x': x, 'y': y};
}

Initial URL

                                

Initial Description
courtesy Jean-Baptiste Jung

Initial Title
Get relative mouse position

Initial Tags

                                

Initial Language
jQuery