设置div 自适应高度和宽度1

var h=document.body.offsetHeight-85;//计算需要自适应窗口的高度( 窗口高度减去其他窗口的高度)
var w=document.body.offsetWidth;
document.getElementById("show").style.width=w;
document.getElementById("show").style.height=h;
$(window).resize(function(){
var h=document.body.offsetHeight-85;
var w=document.body.offsetWidth;
document.getElementById("show").style.width=w;
document.getElementById("show").style.height=h;
});

 

转载于:https://www.cnblogs.com/Optimal/archive/2013/04/28/3049511.html

你可能感兴趣的:(设置div 自适应高度和宽度1)