jQuery日本語リファレンス

jQuery does not mean Japanese Query...

ヌー

Css/API/jQuery

height()

最初の要素の高さをピクセル単位で取得します。

jQuery1.2からは、このメソッドでwindowやdocumentの高さも取得できるようになりました。
サンプル
サンプル1
ボタンをクリックすると、高さを表示します。
サンプルプログラムはiframe内で動いているので、windowの高さは黄色い部分の値になります。予期したよりも小さい値が表示されているかもしれません。その場合は、単独で開いて確認してみて下さい。
<button id="getp">Get Paragraph Height</button>
<button id="getd">Get Document Height</button>
<button id="getw">Get Window Height</button>
<div> </div>
<p>
 Sample paragraph to test height
</p>
function showHeight(ele, h) {
 $("div").text("The height for the " + ele +
 " is " + h + "px.");
}
$("#getp").click(function () {
 showHeight("paragraph", $("p").height());
});
$("#getd").click(function () {
 showHeight("document", $(document).height());
});
$("#getw").click(function () {
 showHeight("window", $(window).height());
});
[フレーム]
© Copyright 2009 by semooh.jp | Design by Free CSS Templates - Thanks to Dubai Apartments

AltStyle によって変換されたページ (->オリジナル) /