ViewportScroller
Class
Defines a scroll position manager. Implemented by BrowserViewportScroller
.
API
abstract class ViewportScroller {}
setOffset
void
Configures the top offset used when scrolling to an anchor.
@paramoffset
[number, number] | (() => [number, number])
A position in screen coordinates (a tuple with x and y values) or a function that returns the top offset position.
@returns
void
getScrollPosition
[number, number]
Retrieves the current scroll position.
@returns
[number, number]
scrollToPosition
void
Scrolls to a specified position.
@paramposition
[number, number]
A position in screen coordinates (a tuple with x and y values).
@returns
void
scrollToAnchor
void
Scrolls to an anchor element.
@paramanchor
string
The ID of the anchor element.
@returns
void
setHistoryScrollRestoration
void
Disables automatic scroll restoration provided by the browser. See also window.history.scrollRestoration info.
@paramscrollRestoration
"auto" | "manual"
@returns
void
Jump to details