jQuery帮助之CSS尺寸(五)outerHeight、outerWidth
想要天天向上,就要懂得享受学习。图老师为大家推荐jQuery帮助之CSS尺寸(五)outerHeight、outerWidth,精彩的内容需要你们用心的阅读。还在等什么快点来看看吧!
outerHeight(options)
获取第一个匹配元素外部高度(默认包括补白和边框)。
此方法对可见和隐藏元素均有效。
返回值:Integer
参数:
options(Boolean) : (false) 设置为 true 时,计算边距在内。
示例:
获取第一段落外部高度。
HTML 代码:
pHello/pp2nd Paragraph/p
jQuery 代码:
var p = $("p:first");
$("p:last").text( "outerHeight:" + p.outerHeight() + " , outerHeight(true):" + p.outerHeight(true) );
结果:
pHello/ppouterHeight: 35 , outerHeight(true):55/p
outerWidth(options)
获取第一个匹配元素外部宽度(默认包括补白和边框)。
此方法对可见和隐藏元素均有效。
返回值:Integer
参数:
options(Boolean) : (false) 设置为 true 时,计算边距在内。
示例:
获取第一段落外部宽度。
HTML 代码:
pHello/pp2nd Paragraph/p
jQuery 代码:
var p = $("p:first");
$("p:last").text( "outerWidth:" + p.outerWidth() + " , outerWidth(true):" + p.outerWidth(true) );
结果:
pHello/ppouterWidth: 65 , outerWidth(true):85/p