jquery under the width, height method of $ (window) and $ (document) is worth distinguishing

Source: Internet
Author: User

The width and height of $ (window) and $ (document) are consistent when there is no vertical scroll bar
When there is a vertical scrollbar, the width of $ (window) and $ (document) match the height of the window to the height of the viewable area, and document is the height of the entire HTML document (including the margin padding border is total)

The width and height of $ (window) and $ (document) are consistent when there is no horizontal scroll bar
The height of $ (window) and $ (document) are consistent when there is a horizontal scroll bar
Window width is the width of the viewable area, document is the width of the entire HTML document (including margin padding border is total)

Summarize:
1. The vertical and horizontal scroll bars do not have the case of $ (window). Width () and $ (document). Width (), $ (window). Height () is consistent with $ (document). Height ()
2. When the vertical and horizontal scrollbars exist or exist at the same time, the width or height of the window is always the width or height of the viewable area (excluding the width height of the scrollbar), while the document documents are always the actual width or height of the page document (including beyond the viewable area)

jquery under the width, height method of $ (window) and $ (document) is worth distinguishing

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.