var wh = $(document.documentElement.clientHeight).height();
var tH = $('.a_Top').height();
var bH = $('.a_BottomBar_b').height();
$('.a_ContentOuter').css('min-height',(wh)+'px');
$('.a_ContentInner').css('min-height',(wh-(tH+bH+29))+'px');
我正在一个函数中编写这段代码,但是当我在 Firefox 中打开这个页面时,它会出错,当我们对整个代码进行评论时它会很好,所以请给我建议并帮助找出使用此代码的正确方法....
最佳答案
添加 $(window).height();
var wh = $(window).height();
var tH = $('.a_Top').height();
var bH = $('.a_BottomBar_b').height();
$('.a_ContentOuter').css('min-height',(wh)+'px');
$('.a_ContentInner').css('min-height',(wh-(tH+bH+29))+'px');
alert($('.a_ContentOuter').css('min-height'));
关于javascript - 如何使用浏览器窗口的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27700348/