【问题标题】:Iframe vertical scroll not working in iOS mobileiframe 垂直滚动在 iOS 移动设备中不起作用
【发布时间】:2015-12-15 16:22:57
【问题描述】:

我正在尝试在 iframe 中显示全屏网站,尽管垂直滚动在 iOS 移动设备上不起作用(在 safari、chrome 上测试)。

我正在使用

<style>
iframe {
    border: 0; 
    position:fixed; 
    top:0; 
    left:0; 
    right:0; 
    bottom:0; 
    width:100%; 
    height:100% 
    -webkit-overflow-scrolling:touch;
    overflow:auto; 
}
</style>

<div style="-webkit-overflow-scrolling:touch;">
    <iframe src="http://www.neti.ee/">
</div>

使用-webkit-overflow-scrolling:touch;据说可以解决问题,但对我不起作用。这可能是什么原因造成的?

【问题讨论】:

    标签: jquery html ios css iframe


    【解决方案1】:

    -webkit-overflow-scrolling:touch;不适用于 iframe。不要使用它,它不是standard css rule。 使用

    overflow-y:scroll; 
    

    【讨论】:

    • 添加了溢出-y:scroll;而不是 -webkit-overflow-scrolling:touch;我仍然无法在 iframe 中滚动网站
    • 试试
    • 很遗憾仍然无法在 iOS 移动设备上运行
    • 提供链接,例如。
    【解决方案2】:

    使用时滚动开始工作:

     <style>
        iframe {
            overflow: scroll !important;
            width: 100%;
            height: 100%;
            border: none;
        }
    
        div {
            height: 100%;
            width: 100%;
            position: absolute;
        }
        body {
            margin:0;
        }
    </style>
    
        <div>
            <iframe src="http://www.neti.ee">
        </div>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-12-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-23
      • 2019-01-13
      • 1970-01-01
      相关资源
      最近更新 更多