2012-07-22 101 views
0

有關如何完成此任務的任何想法?將窗口高度指定爲文檔高度

$(document).css('height', $(window).height()) 

test http://ow.ly/cpqPA

$('body, html').height($(window).height()) 
alert('$(document).height(): ' + $(document).height() + "\n$('body').height(): " + $('body').height() + "\n$('html').height(): " + $('html').height() + '\n$(window).height(): ' + $(window).height()) 

回答

1

爲了得到得到屏幕寬度和高度。

alert ("screen W = " + screen.width); 
alert ("screen H = " + screen.height); 
0

試試這個CSS:

body { 
    position: fixed; 
    top: 0; 
    left: 0; 
    bottom: 0; 
    right: 0; 
}