Using JQuery mousemove to track mouse, Scrolling with wheel is fooling me
I'm noticing something very strange with Chrome/Ubuntu, seen also on the JQuery mousemove page here.
When I use the wheel to scroll vertically, I get new coordinates in pageX, pageY, but the pageY seems to be about 50px-60px off.
I can see 开发者_运维百科this because as soon as I move the mouse a little to the side, the Y coordinate suddenly jumps a lot.
Any ideas what I'm doing wrong, or how to get the "true" pageY coordinate?
Edit1: I now see that on windows I don't get mousemove events at all when scrolling with the wheel.
- Binding to the window scroll event will fire when the mouse wheel is used
- Binding to mousemove event will fire when the mouse is moved
The coordinates are then calculated as follows:
PageX = ClientX + document.body.scrollLeft PageY = ClientY + document.body.scrollTop
精彩评论