javascript - How to get relative cursor position to clicked element when appears click event in JQuery? -
i want read position relative clicked element e.target
instead of eventobject.pagex
, eventobject.pagey
.
var eventobject = null; $(document).click(function(e){ eventobject = e; //how position relative e.target ?? });
have tried:?
var posx = $(this).position().left, posy = $(this).position().top; alert((e.pagex - posx) + ' , ' + (e.pagey - posy));
javascript jquery
No comments:
Post a Comment