ifarme的自适应高度问题

 Html:

<iframe id="iframeid" src="/Home/DisplayiIndex"></iframe>

JS部分

<script type="text/javascript">

//切换打开子页面

function redirectPage(url, obj) {
$("#iframeid").attr("src", url);
}

//动态适应高度

$(window).load(function () {
var h = $(document).height();
console.log(h);
var ifHeight = $(window.top.document).find("iframeid").css({
height: h
});
});

</script>

这样的话每次打开它都会自适应子页面的高度

原文地址:https://www.cnblogs.com/wslpf/p/10789225.html