ViewportScroller
Class
stable
Defines a scroll position manager. Implemented by BrowserViewportScroller.
setOffset
voidConfigures 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
voidgetScrollPosition
[number, number]Retrieves the current scroll position.
@returns
[number, number]scrollToPosition
voidScrolls to a specified position.
@paramposition
[number, number]A position in screen coordinates (a tuple with x and y values).
@paramoptions
ScrollOptions | undefined@returns
voidscrollToAnchor
voidScrolls to an anchor element.
@paramanchor
stringThe ID of the anchor element.
@paramoptions
ScrollOptions | undefined@returns
voidsetHistoryScrollRestoration
voidDisables automatic scroll restoration provided by the browser. See also window.history.scrollRestoration info.
@paramscrollRestoration
"auto" | "manual"@returns
voidJump to details