The differences between the jQuery height (), innerheight (), and outerheight () functions are detailed
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 |
jquer Y version |
supports write operations |
height () |
height |
1.0+ |
1.0+ |
innerheight () |
height + padding |
1.2.6+ |
1.8.0+ |
outerheight () |
height + padding + border |
1.2.6+ |
no |
outerheight (True) |
height+padding+border+margin |
1.2.6+ |
no |
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.
The differences between the jQuery height (), innerheight (), and outerheight () functions are detailed