Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
Window.scrollTo() は文書内の特定の座標までスクロールします。
文書の水平軸上の、左上に表示させたいピクセルです。
yCoord文書の垂直軸上の、左上に表示させたいピクセルです。
options以下のプロパティが含まれているオブジェクトです。
topウィンドウまたは要素をスクロールする Y 軸方向のピクセル数を指定します。
leftウィンドウまたは要素をスクロールする X 軸方向のピクセル数を指定します。
behaviorスクロールを瞬時に行うか、滑らかにアニメーションするかを指定します。このオプションは文字列であり、以下のいずれかの値を設定しなければなりません。
なし (undefined)。
options の使用例:
Window.scroll() はこのメソッドとほぼ同じです。相対スクロールについては、 Window.scrollBy(), Window.scrollByLines(), Window.scrollByPages() を参照してください。
要素をスクロールするには、 Element.scrollTop および Element.scrollLeft を参照してください。
| CSSOM View Module # dom-window-scrollto |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2026年5月13日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.