Home > Web Front-end > JS Tutorial > Example introduction to the difference between height innerHeight outerHeight in jQuery_jquery

Example introduction to the difference between height innerHeight outerHeight in jQuery_jquery

WBOY
Release: 2016-05-16 16:44:28
Original
946 people have browsed it

Under standard browsers:

height: height

innerHeight: height + padding
outerHeight: height + padding + border, when the parameter is true: height + padding + border + margin

html code:

Copy code The code is as follows:

jjjjj


js code:
Copy code The code is as follows:

alert($(" #test").height());
alert($("#test").innerHeight());
alert($("#test").outerHeight());
alert ($("#test").outerHeight(true));

Results:
Results in ie: 17px, 37px, 41px, 61px
Results in ff : 20px, 40px, 44px, 64px

html code:
Copy code The code is as follows:

jjjjj< ;/div>

js code:
Copy code The code is as follows:

alert($("#test").height());
alert($("#test").innerHeight());
alert($("#test"). outerHeight());
alert($("#test").outerHeight(true));
[html]
Results:
Results in ie: 17px, 37px, 41px, 61px
Result in ff: 41px, 61px, 65px, 85px

html code:
[code]
jjjjj


js code:
Copy code The code is as follows:

alert($("#test").height());
alert($("#test").innerHeight());
alert($("#test").outerHeight());
alert($("#test").outerHeight( true));

Results:
Results in ie: 18px, 38px, 42px, 62px
Results in ff: 42px, 62px, 66px, 86px

html code:
Copy code The code is as follows:

jjjjj


js code:
Copy code The code is as follows:

alert($("#test ").height());
alert($("#test").innerHeight());
alert($("#test").outerHeight());
alert($ ("#test").outerHeight(true));

Results:
Results in ie: 36px, 56px, 60px, 80px
Results in ff: 60px , 80px, 84px, 104px

Conclusion: In IE, height includes border and padding and the minimum value of height is 17px. In the same way, width can be obtained, but its minimum value is 15px.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template