Document.documentElement.clientHeight and $ (window). Height () does not get the height of the page visual area correctly

Source: Internet
Author: User

Background: The pop-up layer plug-in (adaptive) implementation suddenly discovers when the visibility area height is obtained, whether document.documentElement.clientHeight or $ (window). Height () is not properly obtained, the code is not a problem;

Solution: Find the error point by Cosole.log Finding the $ (window). Height () Gets the unhealthy and equals $ (document). Height (); Finding data online is due to the absence of a correct HTML5 document declaration

Correct:<!DOCTYPE HTML>     <HTML><!--document Content --</HTML>Error:<!DOCTYPE>     <HTML><!--document Content --</HTML>$ (function () {Console.log ($ (window). Height ()) Console.log (Document.documentElement.clientHeight)})
The value obtained is not the same

Document.documentElement.clientHeight and $ (window). Height () does not get the height of the page visual area correctly

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.