In order to better control the elements to meet our requirements, we can get the height and width of this part through outerheight (options) and outerwidth (options.
Outerheight (options)
Obtain the external height of the First Matching Element (including the padding and border by default ).
This method is effective for both visible and hidden elements.
Return Value: integer
Parameters:
Options (Boolean): When (false) is set to true, the margin is included.
Example:
Obtain the external height of the first section.
HtmlCode:
<P> Hello </P> <p> 2nd paragraph </P>
Jquery code:
VaR P = $ ("P: First ");
$ ("P: Last"). Text ("outerheight:" + P. outerheight () + ", outerheight (true):" + P. outerheight (true ));
Result:
<P> Hello </P> <p> outerheight: 35, outerheight (true): 55 </P>
Outerwidth (options)
Obtain the external width of the First Matching Element (including the padding and border by default ).
This method is effective for both visible and hidden elements.
Return Value: integer
Parameters:
Options (Boolean): When (false) is set to true, the margin is included.
Example:
Obtain the external width of the first section.
HTML code:
<P> Hello </P> <p> 2nd paragraph </P>
Jquery code:
VaR P = $ ("P: First ");
$ ("P: Last"). Text ("outerwidth:" + P. outerwidth () + ", outerwidth (true):" + P. outerwidth (true ));
Result:
<P> Hello </P> <p> outerwidth: 65, outerwidth (true): 85 </P>