$("#iframe_280").on("load",function(){ // iframe加载完后(防止你的ifream还没有加载完成 报错) 高度自适应。
debugger;
var frameObj = document.getElementById("iframe_280").contentDocument || document.getElementById("iframe_280").contentWindow.document;
var mainWrapHeight = $(window).height() - 49 - 21;
var frame_height = frameObj.documentElement.scrollHeight;
$("#iframe_280").height( frame_height < 860 ? mainWrapHeight : frame_height);
});
本文介绍了一种使用JavaScript动态调整iframe元素高度的方法,确保iframe加载完成后能自动适应其内容高度,避免页面布局错位。
1252

被折叠的 条评论
为什么被折叠?



