jquery gets a summary of the various aspect heights and page widths of the elements

Source: Internet
Author: User

Window.onload=function () {varA = $ ("#div"). Width (),//width () returns the width height of the element, excluding Padding/border/marginB = $ ("#div"). Innerwidth (),//innerwidth () returns the element's width height + paddingc = $ ("#div"). Outerwidth (),//Outerwidth () returns the element's width height + padding + borderD = $ ("#div"). Outerwidth (true);//Outerwidth (true) returns the element width height + padding + border + marginConsole.log (a,b,c,d);}
get the height of the browser display area (viewable area):$ (window). Height (); gets the width of the browser display area (viewable area):$ (window). width (); gets the document height of the page$ (document). Height (); gets the document width of the page:$ (document). width ();the height of the body of the browser's current window document:$ (document.body). Height ();Browser Current Window document body width:$ (document.body). width ();gets the vertical height of the scroll bar to the top (that is, the height of the page being rolled up)$ (document). ScrollTop (); to get the vertical width of the scroll bar to the left:$ (document). ScrollLeft ();Gets or sets the width of the element:$ (obj). width ();Gets or sets the height of the element:$ (obj). Height ();The distance from the upper boundary of an element to the top of the body: Obj.offset (). Top; (in case the element's containing element does not contain a scroll bar)The left edge of an element to the leftmost distance of the body: Obj.offset (). to left; (in case the element's containing element does not contain a scroll bar)Returns the offset of the top boundary of the current element to its containing element: Obj.offset (). Top (in the case where the element's containing element contains scroll bars)Returns the offset of the left edge of the current element to its left edge of the containing element: Obj.offset (). Ieft (with scroll bars in the element's containing element)

jquery gets a summary of the various aspect heights and page widths of the elements

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.