标签:
在ifrome内设定最小高度,(此方法只适用于页面内切换高度不一。但是会保留最大高度,返回后保持最大高度不再回到最初页面的高度)
1 <iframe id="one4" width="100%" height="1600px" src="merchant information.html" style="border:1px solid #f4f4f4;" scrolling="no" ></iframe>
将边框颜色设定为和背景颜色一致,使其更像原生页面;
scrolling取消滚动条
1 function reinitIframe(){ 2 var iframe = document.getElementById("one1"); 3 try{ 4 var bHeight = iframe.contentWindow.document.body.scrollHeight; 5 var dHeight = iframe.contentWindow.document.documentElement.scrollHeight; 6 var height = Math.max(bHeight, dHeight); 7 iframe.height = height; 8 }catch (ex){} 9 } 10 window.setInterval("reinitIframe()", 200);
改变id和前后function内的命名,可以实现自适应高度变化。
标签:
原文地址:http://www.cnblogs.com/NB-JDzhou/p/5335812.html