親 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