如何逐步检测支持触摸的设备是否支持溢出滚动?

发布于 2024-10-27 22:22:21 字数 761 浏览 8 评论 0原文

Android 3.0 (Honeycomb) 现在可以在浏览器中支持溢出滚动 。在旧版本的 Android 中,我必须编写自己的 JavaScript 来滚动内部框架、溢出内容和其他元素内的内容,以弥补此问题。此缺陷已记录在 Android 错误跟踪器中,问题为 211868647776,以及其他一些类似的问题。

在新版本的 Android 中,我希望浏览器能够自行处理此功能(如果有能力的话)。除了嗅探用户代理之外,还有其他方法可以嗅探对此的支持吗?我更愿意检查该功能的支持,而不是黑客用户代理嗅探。

我尝试过检查对 scroll 事件的支持,但旧的 Android 浏览器和 Honeycomb 似乎已经有此事件。

jQuery mobile 似乎也不检查是否支持溢出滚动。它们仅检测设备是否支持触摸事件。

Android 3.0 (Honeycomb) now properly supports overflow scrolling in its browser. In older versions of Android, I've had to write my own JavaScript to scroll content within internal frames, overflowed content, and other elements to compensate for this issue. This shortcoming has been documented in the Android bug tracker with issues 2118, 6864, 7776, and a few other similar issues.

With the new release of Android, I'd prefer the browser handle this feature itself, if it's capable. Is there a way to sniff for support of this aside from just sniffing the user agent? I'd prefer to check for support of the feature over hacky user agent sniffing.

I've tried checking support of the scroll event, but both old Android browsers and Honeycomb seem to already have this event.

jQuery mobile also doesn't seem to check for support of overflow scrolling. They only detect whether or not the device supports touch events.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文