Skip to content

Instantly share code, notes, and snippets.

@krutz27
Created October 4, 2013 13:36
Show Gist options
  • Select an option

  • Save krutz27/6826041 to your computer and use it in GitHub Desktop.

Select an option

Save krutz27/6826041 to your computer and use it in GitHub Desktop.
//get relative mouse position
function rPosition(elementID, mouseX, mouseY) {
var offset = $('#'+elementID).offset();
var x = mouseX - offset.left;
var y = mouseY - offset.top;
return {'x': x, 'y': y};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment