1iframe
<div id="iframe_div" style="margin-top:30px" class=" col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main ">
<iframe id="iframe" src="welCome.html" style="margin-top: -65px;width:100%" scrolling="no" marginwidth="0"
frameborder="0" onLoad="this.height=100">
</iframe>
</div>
2自适应函数(需要导入jQuery 包)
<script>
$(function () {
window.setInterval("reinitIframe()", 200);
})
function reinitIframe() {
var iframe = document.getElementById("iframe");
try {
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
console.log(dHeight)
iframe.height = dHeight;
} catch (ex) {
}
}
</script>