如何在 iOS safari 上启用 iframe 滚动条

发布于 2024-10-12 23:01:15 字数 332 浏览 5 评论 0原文

我正在尝试在我的网站上实现 facebook 的直播插件。我看到 PC 和 Mac 浏览器上有滚动条,但 iphone 或 ipad safari 上没有。我认为这是因为 iPhone 和 iPad 对待滚动条的方式不同,因为它们都是基于触摸的设备。所以我希望用两根手指滚动 iframe,但它也不起作用。

这是示例页面(使用不同的 src url) http://para.qacode.com/test.php< /a>

如何在 ios safari 上启用两指滚动或正常滚动条?

I am trying to implement facebook's live stream plugin on my website. I see that there is a scrollbar on pc and mac browsers, but not on iphone or ipad safari. I think it is because iphone and ipad treat scrollbar differently since they are both touch based devices. So I expect to scroll iframe with two fingers, but it does not work either.

Here is sample page (used a different src url) http://para.qacode.com/test.php

How do I enable two finger scrolling or normal scrollbar on ios safari?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

伴梦长久 2024-10-19 23:01:15

在 5 之前的 iOS 版本中,您可以使用两根手指在 iPad/iPhone 上滚动 iframe,但这是一个有点隐藏的功能,大多数人不知道它。我不确定为什么双指滚动不适用于您的 iframe - 也许有一些 JavaScript 拦截了触摸事件?

在 iOS 5 上,此问题已得到修复,并且用一根手指即可按预期使用 iframe 进行滚动。

如果您需要在 iOS 4 及更早版本上滚动页面的子区域,最好的选择是使用 iScroll 等库,它通过 JavaScript 触摸事件处理实现滚动。

On iOS versions prior to 5, you can scroll iframes on iPad/iPhone using two fingers, but this is a bit of a hidden feature and most people don't know about it. I'm not sure why tow-finger scrolling isn't working for your iframe - perhaps there is some JavaScript intercepting the touch event?

On iOS 5 this has been fixed and scrolling works as expected for iframes with one finger.

If you need to scroll a sub-region of the page on iOS 4 and earlier, the best bet is to use a library such as iScroll that implements scrolling with JavaScript touch-event handling.

離殇 2024-10-19 23:01:15

将这些样式应用到父容器:

-webkit-overflow-scrolling:touch;
overflow:auto;

Apply these styles to the parent container:

-webkit-overflow-scrolling:touch;
overflow:auto;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文