Jquery.outerwidth () function explanation

Source: Internet
Author: User

outerWidth()function is used to set or return the outer width of the currently matched element .

The outer width default includes the element's padding (padding), Border (border), but not the width of the margin section. You can also specify a parameter to true include the width of the margin section. Such as:

If you want to get the width of other cases, use width () and innerwidth (),

In jquery, there are 3 functions that get the height of an element, which are height (), innerheight (), and Outerheight ().

Corresponding to this, there are 3 functions that get the width of the element, which are width (), innerwidth (), Outerwidth (), respectively.

Here, we take height() , innerHeight() and outerHeight() 3 functions as examples, to detail the differences between them.

Let's take the example of the box model of element elements to describe the difference between them.

function Height Range jquery version support for write operations
height() Height 1.0+
1.0+
innerHeight() Height + padding 1.2.6+ 1.8.0+
outerHeight() Height + padding + border 1.2.6+ Whether
outerHeight(true) Height+padding+border+margin 1.2.6+ Whether

1. Only height() functions can be used window or document objects.
2, "Support write operation" means that the function can set the height value for the element.
3. 1.4.1+ height() New support parameters are functions (previously only supported values).
4. 1.8.0+ innerHeight() support parameters are numeric or function .

ScrollHeight: Gets the scroll height of the object.

ScrollLeft: Sets or gets the distance between the left edge of the object and the leftmost of the currently visible content in the window

ScrollTop: Sets or gets the distance between the top of the object and the top of the visible content in the window

ScrollWidth: Gets the scrolling width of the object

Offsetheight: Gets the height of the object relative to the layout or parent coordinates specified by the parent coordinate OffsetParent property

Offsetleft: Gets the calculated left position of the object relative to the layout or the parent coordinate specified by the OffsetParent property

OffsetTop: Gets the computed top position of the object relative to the layout or the parent coordinate specified by the OffsetTop property

Event.clientx horizontal coordinates of relative documents

Event.clienty vertical coordinates of relative documents



Event.offsetx horizontal coordinates relative to the container

Event.offsety the vertical coordinate of the relative container

Document.documentElement.scrollTop The vertical scrolling value

Event.clientx+document.documentelement.scrolltop horizontal coordinates of relative documents + amount of vertical scrolling

IE6.0, ff1.06+:

clientwidth = width + padding

clientheight = height + padding

offsetwidth = width + padding + border

offsetheight = height + padding + border

Jquery.outerwidth () function explanation

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.