Home > Web Front-end > JS Tutorial > Implementation code to obtain the relative position of the mouse in a div_javascript skills

Implementation code to obtain the relative position of the mouse in a div_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 17:06:03
Original
1239 people have browsed it
复制代码 代码如下:


JS获取DIV相对坐标





我是DIV,经测试,有2PX的误差...

当前鼠标坐标为:
X:
Y:






如果不对,可以试试将

document.documentElement.scrollLeft

替换成

document.body.scrollLeft
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template