-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
45 lines (32 loc) · 1.09 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
title: "Window: scrollMaxY property"
short-title: scrollMaxY
slug: Web/API/Window/scrollMaxY
page-type: web-api-instance-property
status:
- non-standard
browser-compat: api.Window.scrollMaxY
---
{{APIRef}} {{Non-standard_header}}
The **`Window.scrollMaxY`** read-only property returns the
maximum number of pixels that the document can be scrolled vertically.
## Value
A number.
## Examples
```js
// Scroll to the bottom of the page
let maxY = window.scrollMaxY;
window.scrollTo(0, maxY);
```
## Notes
Do not use this property to get the total document height, which is not equivalent to
{{domxref("window.innerHeight")}} + window\.scrollMaxY, because
{{domxref("window.innerHeight")}} includes the width of any visible horizontal
scrollbar, thus the result would exceed the total document height by the width of any
visible horizontal scrollbar. Instead use
{{domxref("element.scrollHeight","document.body.scrollHeight")}}. See also
{{domxref("window.scrollMaxX")}} and {{domxref("window.scrollTo")}}.
## Specifications
This is not part of any specification.
## Browser compatibility
{{Compat}}