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

mac2022-06-30  21

<div  id="show" style="overflow:auto;">

</div>

<script language="javascript">

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;});

</script>

 

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

相关资源:使用JS CSS实现DIV层自适应高度和宽度
最新回复(0)