如何使用jquery为包装器添加高度?

shi*_*hin 1 css jquery height

我需要使用jquery动态地为每个页面添加css高度.

到目前为止,我得到了以下代码,但它没有为#wrapper增加高度.

有人可以帮我吗?

提前致谢.

function getPageSizeWithScroll(){
if (window.innerHeight && window.scrollMaxY) {// Firefox
    yWithScroll = window.innerHeight + window.scrollMaxY;
    xWithScroll = window.innerWidth + window.scrollMaxX;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
    yWithScroll = document.body.scrollHeight;
    xWithScroll = document.body.scrollWidth;
} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
    yWithScroll = document.body.offsetHeight;
    xWithScroll = document.body.offsetWidth;
}
arrayPageSizeWithScroll = yWithScroll;
//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
return arrayPageSizeWithScroll;
}
var newheight = getPageSizeWithScroll() + 30;

$('#wrapper').css({'height':'newheight'});
Run Code Online (Sandbox Code Playgroud)

rpc*_*tts 10

尝试

$('#wrapper').css("height", newheight);
Run Code Online (Sandbox Code Playgroud)