.outerHeight()
methodThe .outerHeight()
method in jQuery is used to get/set the outer height (including padding,border and optionally margin) of the matched element.
.outerHeight()
method Syntax.outerHeight([includeMargin]) .outerHeight(value) .outerHeight(function)
Parameter | Type | Description |
---|---|---|
inlcudeMargin |
Boolean | whether to include the element's margin when computing, default false |
value |
String,Number | the height value to set |
funtion(index, oldHeight) |
Function | a function returning the outer height to set. index is the position of the element in the set.(based on 0) oldHeight is the old outer height. |
.outerHeight()
Get the current computed outer height(including padding,border and optionally margin) of the first matched element.(If the element is not visible, the height would be 0 )
Get the outer height of the first paragraph
$("p").outerHeight(); $("p").outerHeight(true); // including margin
.outerHeight(value)
Set the outer height(including padding,border) of every matched elements.
Set the outerHeight of each p to 30px
$("p").outerHeight(30);
.outerHeight(function)
Set the outerHeight of the element to 10px higher than the previous.
$("p").outerHeight(function(index,oldValue){ return 10*index + oldValue; });