Highly accurate understanding of jQuery Windows documentation and web pages

  • 2020-03-30 03:30:53
  • OfStack

$(document).height() : the height of the entire page
$(window).height() : the height of the browser's visual window
$(window). ScrollTop () : the height of the top of the browser's visual window from the top of the web page (vertical offset)

Height () == $(window). Height () + $(window).

$(document).height() returns $(window).height() when the page is less than the height of the browser window.

Heights like $(" HTML ").height() and $("body").height() are not recommended.

The reason:

$("body").height() : the body may have a border, which takes less than $(document).height();
$(" HTML ").height() : the meaning of the height obtained varies from browser to browser, meaning that browsers are not compatible.
$(window).height() returns the height of the browser window.


Related articles: