html - 使用 Bootstrap 网格自动调整 iframe 的大小

标签 html css twitter-bootstrap

使用 bootstrap 网格时如何增加 iframe 以匹配它的高度?据我所知,iframe 具有固定的高度,但是当我使用网格调整列时,它不会调整大小。因此,使用其他设置负载高度的解决方案不起作用。

<div class="container-fluid">

    <div class="row">
        <div class="col-md-12">
            <div>
                <DIV>
                    <DIV>
                        <IFRAME XXXstyle="min-height: 100%; width:100%" xstyle="BORDER-TOP: 0px; HEIGHT: 100%; BORDER-RIGHT: 0px; WIDTH: 100%; BORDER-BOTTOM: 0px; BORDER-LEFT: 0px" 
                            frameBorder=0
                            scrolling=no src="footer.html">
                        </IFRAME>
                    </DIV>
                </DIV>
            </div>
        </div>
    </div>
</div>

对于 footer.html 我有:

<div class="container-fluid">
    <div class="row">
        <div class="col-md-2 col-md-offset-1">
        </div>
        <div class="col-md-2 ">
        </div>
        <div class="col-md-2 ">
        </div>
        <div class="col-md-2 ">
        </div>
        <div class="col-md-2 ">
        </div>
    </div>
</div>

谢谢。

最佳答案

我让它像这样工作,并在 body onload 事件中调用它。

虽然我不知道如何用这个对 body onload 事件进行 jqueryfy...

$( window ).resize(function() {
  resizeFrame(document.getElementById('footerIFRAME'))
});

function resizeFrame(f) {
  f.style.height = f.contentWindow.document.body.scrollHeight + "px";
}

关于html - 使用 Bootstrap 网格自动调整 iframe 的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42139854/

相关文章:

html - 删除按钮的 flex 边缘并调整面板的文本

ruby-on-rails - ruby on rails 和 bootstrap,使 field_with_errors 水平显示

javascript - 同时更改两个标签

javascript - HTML5中如何在没有任何 &lt;input&gt; 标签的情况下读取本地系统?

javascript - 检查背景中的特定图像

javascript - 需要在选项卡菜单中向下滚动时隐藏背景图像

javascript - 在 $.get 之后更改属性

javascript - angularjs在指令中找到div的属性

php - 如何在php中回显不同的背景颜色

html - 使用 display flex 在图像顶部垂直对齐 bootstrap btn