jquery 浏览器高度大于500时 body高度自动适应浏览器 ,求助
<script type="text/javascript">
$(document).ready(function()
{
$("#11").height($(window).height());
} )
</script><body >
<div id="11" style="width:100%; background:#FF6"></div>
</body>
这是我之前写的,但是想改成下面这样,求指教
$(document).ready(function()
{
$("#11").height( function(event) {
var liuheight = $(window).height();
if ( liuheight<= 500 )
{
liuheight= 500;
}
else(liuheight> 500)
{
liuheight= $(window).height();
}
});
})
------解决方案--------------------
JScript code
$(document).ready(function()
{ var liuheight = $(window).height();
if ( liuheight <= 500 )
{
liuheight= 500;
}
else
{
liuheight= $(window).height();
}
$("#11").height(liuheight);
})