$ (Document). height (), $ (& quot; body & quot;). height (), $ (window). height () Difference and contact, document. height

Source: Internet
Author: User

$ (Document). height (), $ ("body"). height (), $ (window). height () Differences and links, document. height

The height is used as an example here, and the width problem is similar. During mobile development, a piece of content is often located at the bottom. When the page content is less than one screen, it needs to be set to fixed, but more than one screen, it must be set to static at the top of the page to the bottom. In this case, you need to judge $ (document ). height () and $ (window ). height () is used to identify whether the content is ultra-screen.

$ (Document): entire document
$ ("Body"): body
$ (Window): the view (with doctype enabled)

1) when the page content is greater than the browser window: $ (document ). height () = $ ("body "). height ()> $ (window ). height ();

2) When the page content is smaller than the window: $ (document). height () = $ (window). height () >$ ("body"). height ();

In addition, $ (window). height () is also affected by the DOCTYPE of the page header. By default, it is the premise that DOCTYPE is available.

Related Article

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.