开发者

Mouse click location on an image

I have a GWT container with some stuff in it and an image which is added a clickhandler.

What I try to do is to get the exact mouse event's X and Y coordinates relative to the image. I saw the post here but this is not what I want.

As far as I can see, I have option like getting the image absolute location and event locat开发者_JAVA百科ion but this works only if the user doesn't scroll down the page.

event.getNativeEvent().getClientY()- image.getElement().getAbsoluteTop();


Thanks to Samuel,

here is the solution

event.getNativeEvent().getClientY()- image.getAbsoluteTop() + Document.get().getScrollTop()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜