jquery gets the window height and window height, $(document).height(), $(window).height()
To understand it in one sentence: when the scroll bar of the web page is pulled to the lowest end, $(document).height() == $(window).height() + $(window).scrollTop().
When the height of the web page is less than the browser window, $(document).height() returns $(window).height().
It is not recommended to use heights such as $("html").height() and $("body").height().
Reason:
$("body").height(): The body may have a border, and the obtained height will be smaller than $(document).height();
$("html").height(): The meaning of the height obtained on different browsers will be different. To put it bluntly, the browser is incompatible.
There is a problem with the $(window).height() value. What is returned is not the height of the browser window?
Reason: The web page does not include the statement.
js gets page height and window height
Practical application: Set the appropriate height of the content area
//设置内容区域合适高度 var docH = $(document).height(), winH = $(window).height(), headerH = $(".header").outerHeight(); footerH = $(".footer").outerHeight(); if(docH<=winH+4){ $("div.container").height(winH-headerH-footerH-50); }