Scroll methods on elementsBaseline · Widely available
The scroll() and scrollBy() methods change the scroll position of overflow content within an element. Similar to setting scrollTop and scrollLeft properties, but with options setting whether the scroll should animate smoothly or jump. Note that scrollTo() is an alias for scroll().
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Sep 16, 2020. Widely available since Mar 16, 2023.
Browser support
DesktopChrome
1–60Not supported
61+Supportedsince Sep 5, 2017
Current: 155Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154Firefox
1–35Not supported
36+Supportedsince Feb 24, 2015
Current: 157Safari
1–13.1Not supported
14+Supportedsince Sep 16, 2020
Current: 27MobileChrome Android
18–60Not supported
61+Supportedsince Sep 5, 2017
Current: 155Firefox Android
4–35Not supported
36+Supportedsince Feb 27, 2015
Current: 157Safari iOS
1–13.4Not supported
14+Supportedsince Sep 16, 2020
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
Full syntax and examples are on MDN: scroll event.
Feature detection
JS · check before using
if ("Document" in globalThis && "scrollingElement" in Document.prototype) {
// Document.scrollingElement is available
}Documentation (MDN)
Specification
Usage share
Sub-features
Support for each part of the feature (35). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| Document.scroll_event | 1 | 12 | 6 | 2 | 18 | 6 | 1 |
| Document.scrollingElement | 44 | 12 | 48 | 9 | 44 | 48 | 9 |
| Element.scroll | 61 | 79 | 36 | 10.1 | 61 | 36 | 10.3 |
| Element.scroll.options_behavior_parameter | 61 | 79 | 36 | 14 | 61 | 36 | 14 |
| Element.scroll.options_left_parameter | 61 | 79 | 36 | 10.1 | 61 | 36 | 10.3 |
| Element.scroll.options_top_parameter | 61 | 79 | 36 | 10.1 | 61 | 36 | 10.3 |
| Element.scrollBy | 61 | 79 | 36 | 10.1 | 61 | 36 | 10.3 |
| Element.scrollBy.options_behavior_parameter | 61 | 79 | 36 | 14 | 61 | 36 | 14 |
| Element.scrollBy.options_left_parameter | 61 | 79 | 36 | 10.1 | 61 | 36 | 10.3 |
| Element.scrollBy.options_top_parameter | 61 | 79 | 36 | 10.1 | 61 | 36 | 10.3 |
| Element.scrollHeight | 1 | 12 | 21 | 1 | 18 | 21 | 1 |
| Element.scrollLeft | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| Element.scrollTo | 61 | 79 | 36 | 10.1 | 61 | 36 | 10.3 |
| Element.scrollTo.options_behavior_parameter | 61 | 79 | 36 | 14 | 61 | 36 | 14 |
| Element.scrollTo.options_left_parameter | 61 | 79 | 36 | 10.1 | 61 | 36 | 10.3 |
| Element.scrollTo.options_top_parameter | 61 | 79 | 36 | 10.1 | 61 | 36 | 10.3 |
| Element.scrollTop | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| Element.scrollWidth | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| Element.scroll_event | 1 | 12 | 6 | 1.3 | 18 | 6 | 1 |
| Window.scroll | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
Show 15 more
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| Window.scroll.options_behavior_parameter | 61 | 79 | 36 | 14 | 61 | 36 | 14 |
| Window.scroll.options_left_parameter | 41 | 79 | 36 | 10.1 | 41 | 36 | 10.3 |
| Window.scroll.options_top_parameter | 41 | 79 | 36 | 10.1 | 41 | 36 | 10.3 |
| Window.scrollBy | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| Window.scrollBy.options_behavior_parameter | 61 | 79 | 36 | 14 | 61 | 36 | 14 |
| Window.scrollBy.options_left_parameter | 41 | 79 | 36 | 10.1 | 41 | 36 | 10.3 |
| Window.scrollBy.options_top_parameter | 41 | 79 | 36 | 10.1 | 41 | 36 | 10.3 |
| Window.scrollTo | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| Window.scrollTo.options_behavior_parameter | 61 | 79 | 36 | 14 | 61 | 36 | 14 |
| Window.scrollTo.options_left_parameter | 41 | 79 | 36 | 10.1 | 41 | 36 | 10.3 |
| Window.scrollTo.options_top_parameter | 41 | 79 | 36 | 10.1 | 41 | 36 | 10.3 |
| Window.scrollX | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| Window.scrollX.subpixel_precision | 40 | ≤18 | 55 | ✕ | 40 | 55 | ✕ |
| Window.scrollY | 1 | 12 | 1 | 1 | 18 | 4 | 1 |
| Window.scrollY.subpixel_precision | 40 | ≤18 | 55 | ✕ | 40 | 55 | ✕ |