jQuery简单实现iframe的高度根据页面内容自适应的方法

同域下:

//注意:下面的代码是放在和iframe同一个页面中调用 

$("#myiframe").load(function () {
        var myiframeH = $(this).contents().find("body").height() + 30;
        $(this).height(myiframeH);
        console.log("a---" + myiframeH);
    });

  

 

posted @ 2016-10-21 17:33  James2019  阅读(2899)  评论(0编辑  收藏  举报