问题
An observation regarding the official jScrollPane full page scroll demo...
Click and drag the large vertical scrollbar controlling the window. I've noticed the following behavior when you click+drag the scrollbar and the mouse accidentally leaves the browser window:
- Safari(XP): The scrollbar responds even when dragging outside of the browser window. Can't seem to break it. Awesome.
- FF4(XP): The scrollbar stops responding. It responds again successfully when the mouse re-enters (you don't have to click to start dragging again). Slightly annoying.
- IE8(XP): The scrollbar stops responding. It doesn't respond when the mouse re-enters either (you have to click to drag again). This is the worst of the three.
So Safari (and Webkit, I presume) handles mouse movement outside the window perfectly. Is it even possible to get IE and FF to behave similarly, or are those limitations of the Trident and Gecko engines?
回答1:
[I originally answered a completely different question here by mistake so editing to answer the correct question]
There is very little jScrollPane can do about this. I did a little research but it seems that different browsers behave differently when it comes to triggering rollout/mouseout events when the mouse leaves the browser window. This makes it hard to implement a consistent behaviour within jScrollPane (the problem also occurs when the mouse leaves an iframe if you use full body scroll on an iframe).
I think there are probably security reasons for browsers not reporting mouse movement outside of the window so there is probably very little that can be done about this :(
来源:https://stackoverflow.com/questions/6309250/scrolling-even-when-mouse-leaves-the-browser-window