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