首页 > 其他 > 详细

[转]iframe自适应宽度高度

时间:2015-11-05 10:37:16      阅读:238      评论:0      收藏:0      [点我收藏+]
<iframe id="iframe" onLoad="AutoFit();" frameborder="0" scrolling="no" src="http://www.cnblogs.com">
</iframe>

JQuery代码:

function AutoFit() {
    var ifm = document.getElementById("iframe");
    var subWeb = document.frames ? document.frames["article_frame"].document : ifm.contentDocument;
    if (ifm != null && subWeb != null) {
    $("#iframe").css({ "width": subWeb.body.scrollWidth + "px" });
    $("#iframe").css({ "height": subWeb.body.scrollHeight + "px" }); 
  }
}

 

[转]iframe自适应宽度高度

原文:http://www.cnblogs.com/tongyinaocan/p/4938414.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!