- 时间:2022-04-10 23:43 编辑: 来源: 阅读:
- 扫一扫,手机访问
摘要:Jquery 的outerHeight方法使用介绍
获取第一个匹配元素外部高度(默认包括补白和边框)。
此方法对可见和隐藏元素均有效。
outerHeight(options)
optionsBoolean默认值:'false'
设置为 true 时,计算边距在内。
[b]描述:[/b]
获取第一段落外部高度。
[b]HTML 代码:[/b]
<p>Hello</p><p>2nd Paragraph</p>
[b]jQuery 代码:[/b]
var p = $("p:first");
$("p:last").text( "outerHeight:" + p.outerHeight() + " , outerHeight(true):" + p.outerHeight(true) );
[b]结果:[/b]
<p>Hello</p><p>outerHeight: 35 , outerHeight(true):55</p>