jQuery height() 方法
jQuery 教程
· 2019-03-27 13:44:36
实例
返回 <div> 元素的高度:
$("button").click(function(){
alert($("div").height());
});
定义和用法
height() 方法设置或返回被选元素的高度。
当该方法用于返回高度时, 则返回第一个匹配元素的高度。
当该方法用于设置高度时,则设置所有匹配元素的高度。
如下面的图像所示,该方法不包含 padding、border 或 margin。
相关方法:
- width() - 设置或返回元素的宽度
- innerWidth() - 返回元素的宽度(包含 padding)
- innerHeight() - 返回元素的高度(包含 padding)
- outerWidth() - 返回元素的宽度(包含 padding 和 border)
- outerHeight() - 返回元素的高度(包含 padding 和 border)
语法
返回高度:
$(selector).height()
设置高度:
$(selector).height(value)
使用函数设置高度:
$(selector).height(function(index,currentheight))
| 参数 | 描述 |
|---|---|
| value | 当设置高度时是必需的。规定元素的高度,单位为 px、em、pt 等。 默认单位是 px。 |
| function(index,currentheight) | 可选。规定返回被选元素新高度的函数。
|
点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html
Web Services原理与研发实践
顾宁刘家茂柴晓路 / 机械工业出版社 / 2006-1 / 33.00元
本书以web services技术原理为主线,详细解释、分析包括XML、XML Schema、SOAP、WSDL、UDDI等在内在的web Services核心技术。在分析、阐述技术原理的同时,结合作者在Web Services领域的最新研究成果,使用大量的实例帮助读者深刻理解技术的设计思路与原则。全书共有9章,第1章主要介绍web Services的背景知识;第2-7章着重讲解webServic......一起来看看 《Web Services原理与研发实践》 这本书的介绍吧!