源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

jQuery中outerHeight()方法用法实例

  • 时间:2022-04-01 16:10 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:jQuery中outerHeight()方法用法实例
本文实例讲述了jQuery中outerHeight()方法用法。分享给大家供大家参考。具体分析如下: 此方法获取第一个匹配元素外部高度。 默认情况下外部高度是高度(height)、内补白(padding)和边框(border)之和。 如果参数设置为true的话,外补白(margin)尺寸也会算入外部宽度。 此方法对可见和隐藏元素均有效。 可以与outerWidth()方法结合学习。 [b]语法结构: [/b]
[u]复制代码[/u] 代码如下:
$(selector).outerHeight(options)
[b]参数列表: [/b]
参数 描述
options 定义是否把外补白(margin)计算在内: 一.fase,边距不计算在内,默认值。 二.true,边距计算在内。
[b]实例代码:[/b]
[u]复制代码[/u] 代码如下:
<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.1sucai.cn/" /> <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程序设计有所帮助。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部