jQuery innerWidth() 方法

jQuery 教程 · 2019-03-27 14:26:52

实例

返回 <div> 元素的内部宽度:

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

定义和用法

innerWidth() 方法返回第一个匹配元素的内部宽度。

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

jQuery Dimensions

相关方法:

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

语法

$(selector).innerWidth()

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

查看所有标签

The Elements of Statistical Learning

The Elements of Statistical Learning

Trevor Hastie、Robert Tibshirani、Jerome Friedman / Springer / 2009-10-1 / GBP 62.99

During the past decade there has been an explosion in computation and information technology. With it have come vast amounts of data in a variety of fields such as medicine, biology, finance, and mark......一起来看看 《The Elements of Statistical Learning》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具