jQueryのouterHeight()メソッド
例
<div>要素の外側の高さを返します。
$("button").click(function(){
alert($("div").outerHeight());
});
定義と使用法
outerHeight()メソッドは、最初に一致した要素の外側の高さを返します。
下の画像が示すように、この方法にはパディングとボーダーが含まれます。
ヒント:マージンを含めるには、outerHeight(true)を使用します。
関連する方法:
- width() -要素の幅を設定または返します
- height() -要素の高さを設定または返します
- innerWidth() -要素の幅を返します(パディングを含む)
- innerHeight() -要素の高さを返します(パディングを含む)
- externalWidth() -要素の幅を返します(パディングと境界線を含みます)。
構文
$(selector).outerHeight(includeMargin)
Parameter | Description |
---|---|
includeMargin | Optional. A Boolean value specifying whether or not to include the margin
|
自分で試してみてください-例
を含めるかどうかを指定します。
するwidth()、height()、innerHeight()、innerWidth()、outerWidth()、outerHeight()の使用方法。