jQuery outerHeight() 方法

jQuery 教程 · 2019-03-27 15:43:21

实例

返回 <div> 元素的外部高度:

$("button").click(function(){ alert($("div").outerHeight()); });

定义和用法

outerHeight() 方法返回第一个匹配元素的外部高度。

如下面的图像所示,该方法包含 padding 和 border。

提示:如需包含 margin,请使用 outerHeight(true)。

jQuery Dimensions

相关方法:

  • width() - 设置或返回元素的宽度
  • height() - 设置或返回元素的高度
  • innerWidth() - 返回元素的宽度(包含 padding)
  • innerHeight() - 返回元素的高度(包含 padding)
  • outerWidth() - 返回元素的宽度(包含 padding 和 border)

语法

$(selector).outerHeight(includeMargin)

参数 描述
includeMargin 可选。布尔值,规定是否包含 margin。
  • false - 默认。不包含 margin。
  • true - 包含 margin。

点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html

查看所有标签

Web Data Mining

Web Data Mining

Bing Liu / Springer / 2011-6-26 / CAD 61.50

Web mining aims to discover useful information and knowledge from Web hyperlinks, page contents, and usage data. Although Web mining uses many conventional data mining techniques, it is not purely an ......一起来看看 《Web Data Mining》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

html转js在线工具
html转js在线工具

html转js在线工具