jQuery中outerHeight()方法用法实例
2015-01-19 00:00
603 查看
本文实例讲述了jQuery中outerHeight()方法用法。分享给大家供大家参考。具体分析如下:
此方法获取第一个匹配元素外部高度。
默认情况下外部高度是高度(height)、内补白(padding)和边框(border)之和。
如果参数设置为true的话,外补白(margin)尺寸也会算入外部宽度。
此方法对可见和隐藏元素均有效。
可以与outerWidth()方法结合学习。
语法结构:
参数列表:
参数
描述
options
定义是否把外补白(margin)计算在内:
一.fase,边距不计算在内,默认值。
二.true,边距计算在内。
实例代码:
点击按钮可以显示div元素外部高度。
希望本文所述对大家的jQuery程序设计有所帮助。
此方法获取第一个匹配元素外部高度。
默认情况下外部高度是高度(height)、内补白(padding)和边框(border)之和。
如果参数设置为true的话,外补白(margin)尺寸也会算入外部宽度。
此方法对可见和隐藏元素均有效。
可以与outerWidth()方法结合学习。
语法结构:
$(selector).outerHeight(options)
参数列表:
参数
描述
options
定义是否把外补白(margin)计算在内:
一.fase,边距不计算在内,默认值。
二.true,边距计算在内。
实例代码:
<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.jb51.net/" /> <title>outerHeight()函数-脚本之家</title> <style type="text/css"> div{ background-color:green; height:100px; width:200px; padding:10px; margin:10px; border:5px solid red; } </style> <script type="text/javascript" src="mytest/jQuery/jquery-1.8.3.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("button").click(function(){ $("div").text($("div").outerHeight(true)) }) }) </script> </head> <body> <div>此处显outerHeight数值</div> <button>点击查看div的outerHeight</button> </body> </html>
点击按钮可以显示div元素外部高度。
希望本文所述对大家的jQuery程序设计有所帮助。
相关文章推荐
- jQuery中outerHeight()方法用法实例
- jQuery中width()方法用法实例
- jQuery中hide()方法用法实例
- jQuery中val()方法用法实例
- jQuery中ajax的load()方法用法实例
- jQuery中animate()方法用法实例
- jQuery中after()方法用法实例
- jQuery中remove()方法用法实例
- jQuery中append()方法用法实例
- jQuery中removeData()方法用法实例
- jQuery中hide()方法用法实例
- jQuery中width()方法用法实例
- jQuery中ajax的post()方法用法实例
- jquery中post方法用法实例
- jQuery的css()方法用法实例
- jQuery中detach()方法用法实例
- jQuery中remove()方法用法实例
- jQuery中ajax的load()方法用法实例
- jQuery中ajax的get()方法用法实例