Scroll methods on elements
Widely available since 2023-03-16
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()
.
Learning resources on MDN
- Document: scroll event
- Document: scrollingElement property
- Element: scroll() method
- Element: scrollBy() method
- Element: scrollHeight property
- Element: scrollLeft property
- Element: scrollTo() method
- Element: scrollTop property
- Element: scrollWidth property
- Element: scroll event
- Window: scroll() method
- Window: scrollBy() method
- Window: scrollTo() method
- Window: scrollX property
- Window: scrollY property
Browser support (view on caniuse.com)
- Chrome 61 Released on 2017-09-05
- Chrome Android 61 Released on 2017-09-05
- Edge 79 Released on 2020-01-15
- Firefox 36 Released on 2015-02-24
- Firefox for Android 36 Released on 2015-02-27
- Safari 14 Released on 2020-09-16
- Safari on iOS 14 Released on 2020-09-16