【发布时间】:2015-03-06 07:03:47
【问题描述】:
我正在 iframe 中加载一个 aspx 网页。 iframe 中的内容可以比 iframe 的高度更高。 iframe 不应有滚动条。
我在 iframe 中有一个包装器 div 标记,它基本上是所有内容。我写了一些 jQuery 来实现调整大小:
$("#TB_window", window.parent.document).height($("body").height() + 50);
在哪里
TB_window 是包含 Iframe 的 div。
body - iframe中aspx的body标签。
此脚本附加到 iframe 内容。我从父页面获取TB_window 元素。虽然这在 Chrome 上运行良好,但 TB_window 在 Firefox 中崩溃。我真的很困惑/不知为什么会发生这种情况。
【问题讨论】:
-
那个.aspx iframe页面来自同一个域名?
-
你能检查$("body").height()在firefox中有值吗?
-
是的..iframe 与容器页面在同一个域中
-
@MichaelLWatson 看起来萤火虫监视窗口的身体高度值为 0...Chrome 确实有一个值
-
Angular iFrame 自动高度示例:gitlab.com/reduardo7/angular-iframe-auto-height
标签: javascript jquery asp.net iframe