如何获取作为相对元素的子元素的 DOM 元素的鼠标位置?
如何获取 DOM 元素(即相对元素的子元素)上的鼠标位置 (在 JavaScript 中)?
How to get the mouse position over a DOM element, that is a child of a relative element
(in JavaScript)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是当我想要获取元素中的鼠标位置时使用的方法。它返回标准轴(底部 -> 顶部)或网络轴(顶部 -> 底部)中的 y 值。
它需要 jQuery。
Here's the method I use when I want to get the mouse position in an element. It returns the y value in a standard axis (bottom -> top) or in the web axis (top -> bottom).
It requires jQuery.