日期:2014-05-16  浏览次数:20342 次

很难解决的问题
我用window.event.clientY;去的鼠标位置,但是鼠标滚轮滚动时位置就不准了,很难解决,大家帮帮忙!

------解决方案--------------------
window.event.y用这个
------解决方案--------------------
event.y: Sets or retrieves the y-coordinate, in pixels, of the mouse pointer 's position relative to the parent element.

event.screenY: Sets or retrieves the y-coordinate of the mouse pointer 's position relative to the user 's screen.

event.offsetY: Sets or retrieves the y-coordinate of the mouse pointer 's position relative to the object firing the event.

event.clientY: Sets or retrieves the y-coordinate of the mouse pointer 's position relative to the client area of the window, excluding window decorations and scroll bars.
看看说明,哪个是你需要的。
------解决方案--------------------
window.event.x + document.documentElement.scrollLeft;
window.event.y + document.documentElement.scrollTop;