Posted By

adambundy on 12/15/09


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

adambundy
rygiel


Get relative mouse position


 / Published in: jQuery
 

courtesy Jean-Baptiste Jung

  1. function rPosition(elementID, mouseX, mouseY) {
  2. var offset = $('#'+elementID).offset();
  3. var x = mouseX - offset.left;
  4. var y = mouseY - offset.top;
  5.  
  6. return {'x': x, 'y': y};
  7. }

Report this snippet  

You need to login to post a comment.