1. 程式人生 > >JQuery height()、innerHeight()、outerHeight()、outerHeight(true)

JQuery height()、innerHeight()、outerHeight()、outerHeight(true)

用於獲取元素高度的四個函式。以盒子模型為例。

1、height() 獲取元素content的高度


2、innerHeight()  獲取匹配元素集合中第一個元素的當前計算的內部高度,包括頂部和底部的padding+content。不適用於window和document物件。


3、outerHeight() 獲取匹配元素集合的第一個元素的當前計算的外部高度,包括頂部和底部的padding和border、content。

 

4、outerHeight()獲取匹配元素集合的第一個元素的當前計算的外部高度,包括頂部和底部的margin/padding/border、content。