首页 > 其他 > 详细

控制子窗口的高度

时间:2017-10-06 15:51:27      阅读:232      评论:0      收藏:0      [点我收藏+]
 1  if (iframe.get(0).attachEvent) {
 2             iframe.get(0).attachEvent("onload", function () {
 3                 var new_h = iframe.get(0).contentWindow.document.documentElement.offsetHeight + document.getElementsByClassName(‘nav‘)[0].offsetHeight;
 4                 iframe.get(0).height = h >= new_h ? (h - 34) : (new_h - 34);;
 5 
 6             });
 7             return;
 8         } else {
 9             iframe.get(0).onload = function () {//将子iframe的高度设置为子页面的高度
10 
11                 var new_h = iframe.get(0).contentDocument.body.offsetHeight + document.getElementsByClassName(‘nav‘)[0].offsetHeight;
12 
13                 iframe.get(0).height = h >= new_h ? (h) : (new_h);
14                 //iframe.get(0).height = new_h;
15             }
16         };

 

控制子窗口的高度

原文:http://www.cnblogs.com/liujianshe1990-/p/7631593.html

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