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/window/scrollto/index.html | 77 +++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 files/ja/web/api/window/scrollto/index.html (limited to 'files/ja/web/api/window/scrollto') diff --git a/files/ja/web/api/window/scrollto/index.html b/files/ja/web/api/window/scrollto/index.html new file mode 100644 index 0000000000..fb80f7819e --- /dev/null +++ b/files/ja/web/api/window/scrollto/index.html @@ -0,0 +1,77 @@ +--- +title: window.scrollTo +slug: Web/API/Window/scrollTo +tags: + - API + - CSSOM View + - Method + - NeedsMarkupWork + - Reference +translation_of: Web/API/Window/scrollTo +--- +

{{APIRef}}

+ +

Window.scrollTo() は文書内の特定の組み合わせの座標までスクロールします。

+ +

構文

+ +
window.scrollTo(x-coord, y-coord)
+window.scrollTo(options)
+
+ +

引数

+ + + +

- または -

+ + + +

+ +
window.scrollTo(0, 1000);
+
+ +

options の使用例:

+ +
window.scrollTo({
+  top: 100,
+  left: 100,
+  behavior: 'smooth'
+});
+ +

+ +

{{domxref("Window.scroll()")}} はこのメソッドとほぼ同じです。相対スクロールについては、 {{domxref("Window.scrollBy()")}}, {{domxref("Window.scrollByLines()")}}, {{domxref("Window.scrollByPages()")}} を参照してください。

+ +

要素をスクロールするには、 {{domxref("Element.scrollTop")}} および {{domxref("Element.scrollLeft")}} を参照してください。

+ +

仕様書

+ + + + + + + + + + + + + + + + +
仕様書状態備考
{{ SpecName('CSSOM View', '#dom-window-scroll', 'window.scroll()') }}{{ Spec2('CSSOM View') }}初回定義
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.Window.scrollTo")}}

-- cgit v1.2.3-54-g00ecf