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";

}


发布了19 篇原创文章 · 获赞 5 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/u011151452/article/details/53256643