get mouse position with respect to parent element
- by ZX12R
this is my setup
<div id="uxcParent">
<div id="uxcClickable"></div>
</div>
now when a user clicks in the inner element i want the mouse position with respect to the parent div and not the page.
this what i tried.
var x= e.pageX- obj.offsetLeft;
var x= e.pageY- obj.offsetTop;
this works fine only when i don't scroll the page. I want the function to return the same values no matter where my elements are on the same page.