文字
分享

返回值:Integer

outerWidth([options])

概述

获取第一个匹配元素外部宽度(默认包括补白和边框)。

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

参数

optionsBoolean默认值:'false'V1.2.6

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

示例

描述:

获取第一段落外部宽度。

HTML 代码:

1

<p>Hello</p><p>2nd Paragraph</p>

jQuery 代码:

1

2

var p = $("p:first");

$("p:last").text( "outerWidth:" + p.outerWidth() + " , outerWidth(true):" + p.outerWidth(true) );

结果:

1

<p>Hello</p><p>outerWidth: 65 , outerWidth(true):85</p>


上一篇:outerHeight([options])下一篇:文档处理