Element.scrollTo() scrolls to a particular set of coordinates inside that element (MDN). Pass (x, y) or an options object with top, left, and behavior. MDN: this method is an alias forElement.scroll().
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
Syntax
Call el.scrollTo. Start with this line.
JavaScript
el.scrollTo(x, y) or el.scrollTo(options)
Call
What it does
el.scrollTo(x, y) or el.scrollTo(options)
Primary signature.
el.scrollTo(...)
Call with the arguments your case needs.
Built into the browser. Call scrollTo(...) on an Element — no import required.
Library declarations
JavaScript
el.scrollTo(x, y) or el.scrollTo(options)
Parameters
Parameter
Description
options.behavior
Optional. smooth, instant, or auto
Promise interrupted
Optional. True if another scroll cut this one short
Return Value
Return Value
Description
*
Promise<{ interrupted }> (support varies)
JavaScript Examples
Example 1 — Scroll To Coordinates
MDN: scrollTo(0, 1000) — absolute position inside the element.
interrupted. True if another programmatic scroll started first.
Feature-detect. Test box.scrollTo(0, 0) instanceof Promise.
Fallback. If no Promise, scroll still works — just no await.
Compatibility
Browser Support
Element.scrollTo() is Baseline Widely available (MDN, since January 2020). It is not Deprecated, Experimental, or Non-standard. Promise return / interrupted may vary — feature-detect if you depend on it.
✓ Baseline Widely available
Element.scrollTo()
Scroll an element to absolute coordinates. Alias of scroll(); pair with scrollBy for relative moves.
BaselineWidely available
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
scrollTo()Baseline
Bottom line: Safe for modern apps. Prefer options + behavior for smooth UX; detect Promise support before awaiting.
Frequently Asked Questions
It scrolls an element to a particular set of coordinates inside that element (MDN). Pass x/y numbers or an options object with top, left, and behavior.
No. MDN marks Element.scrollTo() as Baseline Widely available (since January 2020). It is not Deprecated, Experimental, or Non-standard. Some parts (such as the Promise return) may vary by browser.
MDN documents a Promise that fulfills with { interrupted }. interrupted is true if another programmatic scroll started on the same element before the first finished. Feature-detect if you rely on the Promise.
Yes. MDN documents scrollTo() as an alias for Element.scroll() — identical syntax and behavior.
scrollTo() jumps to absolute coordinates. scrollBy() adds a relative delta to the current position.
Optional string: smooth (animate), instant (jump), or auto (use the element’s CSS scroll-behavior). Default is auto (MDN).