From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/api/htmlelement/offsettop/index.html | 62 +++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 files/ja/web/api/htmlelement/offsettop/index.html (limited to 'files/ja/web/api/htmlelement/offsettop') diff --git a/files/ja/web/api/htmlelement/offsettop/index.html b/files/ja/web/api/htmlelement/offsettop/index.html new file mode 100644 index 0000000000..76d4588b63 --- /dev/null +++ b/files/ja/web/api/htmlelement/offsettop/index.html @@ -0,0 +1,62 @@ +--- +title: HTMLElement.offsetTop +slug: Web/API/HTMLElement/offsetTop +tags: + - API + - CSSOM View + - Property + - Read-only + - Reference +translation_of: Web/API/HTMLElement/offsetTop +--- +
{{ APIRef("HTML DOM") }}
+ +

HTMLElement.offsetTop 読み取り専用プロパティは、{{domxref("element.offsetParent","offsetParent")}} ノードの上端に対して現在の要素の距離を返します。

+ +

構文

+ +
topPos = element.offsetTop;
+ +

引数

+ + + +

+ +
var d = document.getElementById("div1");
+var topPos = d.offsetTop;
+
+if (topPos > 10) {
+  // 要素が offsetParent から 11px 以上離れている場合の処理をここに記述
+}
+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様状態コメント
{{SpecName('CSSOM View', '#dom-htmlelement-offsettop', 'offsetTop')}}{{Spec2('CSSOM View')}}
+ +

ブラウザー互換性

+ + + +

{{Compat("api.HTMLElement.offsetTop")}}

+ +

仕様に従って、要素が非表示 (この要素または任意の祖先の style.display"none")である場合、または要素自体の style.position"fixed" に設定される場合、このプロパティは WebKit で null を返します。

+ +

このプロパティは、要素自体の style.position"fixed" に設定されている場合、Internet Explorer (9) で null を返します。(display:none であってもこのブラウザに影響しません。)

-- cgit v1.2.3-54-g00ecf