您的位置:首页 > Web前端 > JQuery

Jquery 的outerHeight方法使用介绍

2013-09-11 00:00 519 查看
获取第一个匹配元素外部高度(默认包括补白和边框)。

此方法对可见和隐藏元素均有效。

outerHeight(options)

optionsBoolean默认值:'false'

设置为 true 时,计算边距在内。

描述:
获取第一段落外部高度。

HTML 代码:
<p>Hello</p><p>2nd Paragraph</p>

jQuery 代码:
var p = $("p:first"); 
$("p:last").text( "outerHeight:" + p.outerHeight() + " , outerHeight(true):" + p.outerHeight(true) );

结果:
<p>Hello</p><p>outerHeight: 35 , outerHeight(true):55</p>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: