Scrolling even when mouse leaves the browser window?

不打扰是莪最后的温柔 提交于 2020-01-03 21:07:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!