Window.scrollMaxY

非標準: この機能は標準ではなく、標準化の予定もありません。公開されているウェブサイトには使用しないでください。ユーザーによっては使用できないことがあります。実装ごとに大きな差があることもあり、将来は振る舞いが変わるかもしれません。

Window.scrollMaxY は読み取り専用プロパティで、文書が縦方向にスクロールできる最大ピクセル数を返します。

構文

js
yMax = window.scrollMaxY;
  • yMax はピクセル数です。

js
// ページの下端までスクロールする
let maxY = window.scrollMaxY;

window.scrollTo(0, maxY);

このプロパティを、文書の全体の高さを取得するためには使用しないでください。これは window.innerHeight + window.scrollMaxY とは等しくありません。これは window.innerHeight には表示中の水平スクロールバーがすべて含まれるからであり、結果は文書の幅よりすべての表示中の水平スクロールバーの幅だけ大きくなります。代わりに document.body.scrollHeight を使用してください。 window.scrollMaxX および window.scrollTo も参照してください。

仕様書

どの仕様書にも含まれていません。

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
scrollMaxY
Non-standard

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Non-standard. Check cross-browser support before using.