window.onresize 左側width固定,右側width隨瀏覽器大小變化 自適應

html:

<div class="left z" id="left"></div>
<iframe id="right" src="/admin/cjrd/index.html" frameborder="0"></iframe>

js:


window.onresize = function()
{
var lheight = $('#left').height();
var height  = document.documentElement.clientHeight - $('.head').height();
if(height > lheight){
$('#left').height(height)
}


var width = document.documentElement.clientWidth -  220;
$('#right').width(width)
$('#right').height(height - 4);
document.getElementById("myframe").height="300";
document.getElementById("myframe").width="300";

}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章