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

{{ApiRef}}

+ +

概要

+ +

ウィンドウを文書内の特定の位置までスクロールします。

+ +

構文

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

引数

+ + + +

または

+ + + +

+ +
<!-- 100 個目の垂直ピクセル上にウィンドウの最上部を配置します。 -->
+
+<button onClick="scroll(0, 100);">click to scroll down 100 pixels</button>
+
+ +

スクロールの動作を変更する

+ +

スクロールの仕方を変えたいなら、options で指定してください

+ +
window.scroll({
+  top: 1000,
+  behavior: "smooth"
+});
+ +

注記

+ +

効果としては、 {{domxref("window.scrollTo")}} もこのメソッドと同じです。 繰り返し特定の距離をスクロールさせるには {{domxref("window.scrollBy")}} を使用してください。

+ +

次のページもご覧下さい : {{domxref("window.scrollByLines")}} 、 {{domxref("window.scrollByPages")}} 、 {{domxref("Element.scrollIntoView()")}}

+ +

仕様

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{ SpecName('CSSOM View', '#dom-window-scroll', 'window.scroll()') }}{{ Spec2('CSSOM View') }} +

Initial definition.

+
-- cgit v1.2.3-54-g00ecf