设置父级iframe自适应内容页高度

设置父级iframe自适应内容页高度, 子页面设置父页面iframe高度

将下面的代码加入到子页面


/* 设置父级iframe 自适应内容页高度,
   子页面设置父页面iframe高度               
*/
window.onload = function () {
    
    
	//var height = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
	var height = Math.max(window.outerHeight, document.body.clientHeight);               
	console.log(588, "高度" + height);            
	this.frameElement.height = height+38;
}

猜你喜欢

转载自blog.csdn.net/u011511086/article/details/132420697