【发布时间】:2014-01-29 17:53:16
【问题描述】:
我需要根据iframe 内容的高度调整此bootstrap 模式的大小,因为它是动态的。
使用onload 和以下函数我什么也没得到。
window.resizeIframe = function () {
var frame = $('#custom-frame');
var modalHeight = $('#custom-frame').contents().height();
frame.height(modalHeight);
$(window).resize(function() {
frame.height(modalHeight);
});
};
我提供了一个 plunker: http://plnkr.co/edit/eElqXJwvxmpc1XMrdwIK?p=preview
【问题讨论】:
-
链接显示找不到 Plunk。
-
不,很好。再试一次。。
-
叹息。我不会骗你的。如果我是你,我只会使用 JSFiddle。
-
更新: 事实证明 Plunker 不能很好地与工作代理一起工作。到处都是 XMLHttpRequest 错误。
-
虽然这个是关闭的(有点不准确) - 基于 Google 的 Bootstrap 结果 - 将此 css 添加到 iframe 标记可解决模态的大小: style="min-height: [您的首选像素高度];"
标签: javascript jquery html twitter-bootstrap iframe