Jquery,javascript Gets the height and width of the Web page (document). Height/$ (window). Height

Source: Internet
Author: User

One, JavaScript Web page visible area width: Document.body.clientWidth Web page Visible Area High: Document.body.clientHeight Web page visible area width: Document.body.offsetWidth (including edge width) web page visible Area High: document.body.offsetHeight (including high edges) page body Full text width: document.body.scrollWidth Page body Full text High: Document.body.scrollHeight Web page is rolled High: Document.body.scrollTop page is rolled left: Document.body.scrollLeft page body part: Window.screent ...

First, JavaScript

Web page Visible area width: document.body.clientWidth

Web page Visible Area height: document.body.clientHeight

Web page Visible Area width: document.body.offsetWidth (including edge width)

Web page Visible Area High: document.body.offsetHeight (including edge height)

Page body Full text width: document.body.scrollWidth

Page body Full text High: Document.body.scrollHeight

Page is rolled away High: document.body.scrollTop

Webpage is rolled away left: document.body.scrollLeft

Page body part: Window.screentop

Page body part left: Window.screenleft

High screen resolution: Window.screen.height

Width of screen resolution: Window.screen.width

Screen available work area height: window.screen.availHeight

Screen available work area width: window.screen.availWidth

Second, jquery

Gets the height of the browser display area: $ (window). Height ();

Gets the width of the browser display area: $ (window). width ();

Gets the document height of the page: $ (document). Height ();

Gets the document width of the page: $ (documents). width ();

Gets the vertical height of the scroll bar to the top: $ (document). ScrollTop ();

Gets the vertical width of the scroll bar to the left: $ (document). ScrollLeft ();

third, calculate element position and offset

The offset method is a useful way to return the offset information for the first element in a wrapper set. By default, the offset information is relative to the body. The result contains top and left two properties.

Offset (options, results)

Options.relativeto Specifies the ancestor element relative to the offset position. This element should be relative or absolute positioned. Omitted is relative to body.

Options.scroll whether the scroll bar is counted, by default true

options.padding whether to calculate padding, default false

Options.margin whether margin is counted, by default true

Options.border whether the border is counted, by default true

Jquery,javascript Gets the height and width of the Web page (document). Height/$ (window). Height

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.