2014-12-30 39 views
0
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中打开这个页面,这将是一个错误,当我们在这整个代码注释会被罚款,所以请给我的建议,并帮助找到使用此代码的正确方法....如何使用浏览器窗口的大小?

+5

“_it将是一个错误_” - 什么错误?请发布您收到的错误。 –

+2

应该使用'$(window).height()'。 –

+2

'document.documentElement.clientHeight'是一个数字,如何创建一个数字的jQuery对象? – Teemu

回答

3

添加$(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')); 
相关问题