【问题标题】:iframe scrolling on ios within a fixed div not workingiframe 在固定 div 内的 ios 上滚动不起作用
【发布时间】:2019-03-22 11:50:56
【问题描述】:

肯定有办法解决这个问题!我已经尝试了几个过去解决的选项,但现在仍然没有一个工作。

我发现的最新的是这个;

将 iframe 包装在 div 中并应用滚动 css。

.scroller {
    height: 300px;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch !important;
}

然后,使用 javascript 检测 iframe 的内容高度,并将 iframe 的高度设置为与内容高度相同。所以页面加载后,html会是这样的;

<div class="scroller">
    <iframe src="path_to_your_page" style="height: 1672px;"></iframe>
</div>

这有效.... 仅当 iframe 来自同一域时,否则您将收到跨域框架错误。

还有什么可行的想法吗?

【问题讨论】:

    标签: ios iframe scroll fixed


    【解决方案1】:

    如果您使用的是 asp.net,请确保您的 web.config 文件中没有。否则,请确保您的网站as documented here 中不存在该标头。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-12-26
      • 2011-11-28
      • 2013-02-13
      • 1970-01-01
      • 1970-01-01
      • 2016-08-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多