The following is a summary of jQuery’s methods of obtaining the height and width of pages and individual elements and is shared with everyone.
Get the height of the browser display area (visual area):
The width of the document body of the current browser window:
Get or set the width of the element:
The distance from the upper border of an element to the top of body: obj.offset().top; (when the containing element does not contain scroll bars)
The distance from the left edge of an element to the leftmost position of body: obj.offset().left; (when the containing element does not contain a scroll bar)
Returns the offset from the upper edge of the current element to the upper edge of its containing element: obj.offset().top (in the case where the element's containing element contains a scroll bar)
Returns the offset from the left edge of the current element to the left edge of its containing element: obj.offset().left (in the case where the element's containing element contains a scroll bar)
obj.offset().top;
Sets or returns the number of pixels that have been scrolled to the left or top edge of the element. Simply put, it is to set or get the offset of the matching element relative to the upper or left side of the scroll bar. These pixels are only useful if the element has scrollbars, for example, if the element's CSS overflow property is set to auto. These properties are also only defined on the or tags of the document (this depends on the browser), and together they are used to specify the position of the scrolling document. Note that these properties do not specify the amount of scrolling for an tag. This is a non-standard but well-supported property
The above is all the content introduced in this article, I hope you all like it.