开发者

JavaScript: mouse coordinates

I have two div boxes: one that is large is the parent to the other that is small. With propeties offsetX and offsetY, I find out the coorinates of the mouse pointer. I only need coordinates relativ开发者_如何学Ce to the large box, but when the mouse pointer is over the small box, coordinates are figured out relative to this small box. How do I get coordinates relative to the large box even though the mouse pointer is over the small box?


I assume that is because the small box is absolutely or relatively positioned (position: absolute position: relative). Can you change that so that only the parent is absolutely positioned?

Otherwise, the JS Frameworks should offer everything you need to convert relative into absolute positions, and correlate them to the mouse cursor.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜