【问题标题】:iOS - iframe is capturing scroll events even though it doesn't need to scrolliOS - iframe 正在捕获滚动事件,即使它不需要滚动
【发布时间】:2018-04-30 22:39:35
【问题描述】:

我的页面由一个 iframe 和一些溢出视口的额外内容组成:

当用户尝试在 iframe 上滚动时,滚动事件在 iframe 内触发,出于安全原因,父窗口对此一无所知。
但是因为 iframe 比它的内容高,它不需要任何滚动,因此应该将滚动事件传播到父窗口

它在this example 中按预期工作。

但是,一旦 iframe 被包含在带有 overflow: autoscroll 的 div 中,它就不再适用于 iOS (11.3.1),正如您在 this other example 中看到的那样。

有谁知道如何解决这个问题?任何帮助表示赞赏!

我尝试了什么

  • overflow: hidden 在 iframe 上
  • -webkit-overflow-scrolling: touch 在 iframe 上
  • iframe 标签上的scrolling="no" 属性
  • iframe 上的pointer-events: none 修复了滚动问题,但你can't interact with the iframe anymore

【问题讨论】:

  • 你有解决办法吗?

标签: ios css iframe scroll overflow


【解决方案1】:

在具有定义高度的任何父 div 上添加 -webkit-overflow-scrolling: touch 可以解决问题。

这是最初损坏的示例的工作版本:link

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-28
    • 2012-05-02
    • 2023-03-04
    • 2014-11-20
    相关资源
    最近更新 更多