即使鼠标离开浏览器窗口也滚动?

编程入门 行业动态 更新时间:2024-10-26 14:38:04
本文介绍了即使鼠标离开浏览器窗口也滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

关于官方jScrollPane的观察整页滚动演示 ...

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):即使将鼠标拖动到浏览器窗口的外面,滚动条也会响应.似乎无法打破它.很棒.
  • FF4(XP):滚动条停止响应.当鼠标再次进入时,它会再次成功响应(您无需单击即可开始再次拖动).有点烦人.
  • IE8(XP):滚动条停止响应.当鼠标再次进入时,它也没有响应(您必须再次单击以拖动).这是三者中最糟糕的.

因此Safari(我想是Safari,和Webkit)可以完美地处理鼠标在窗口外的移动.甚至有可能使IE和FF具有类似的行为,还是Trident和Gecko引擎的那些局限性?

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?

推荐答案

[我最初回答 a完全不同的问题在这里是错误的,因此请编辑以回答正确的问题]

[I originally answered a completely different question here by mistake so editing to answer the correct question]

jScrollPane对此无能为力.我做了一些研究,但是当鼠标离开浏览器窗口时,触发启动/鼠标事件时,不同的浏览器的行为似乎有所不同.这使得很难在jScrollPane中实现一致的行为(如果您在iframe上使用全身滚动,则当鼠标离开iframe时也会发生此问题.)

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 :(

更多推荐

即使鼠标离开浏览器窗口也滚动?

本文发布于:2023-10-08 08:59:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1472134.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:鼠标   浏览器   窗口

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!