首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

很难解决的有关问题

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

很难解决的问题
我用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;

热点排行