interface ScrollOptions {
    altOffset?: CoordinateOffset;
    altTarget?: string | Element | TargetCoordinates;
    amount?: number;
    asFractionOf?: "content" | "visible" | "pixel";
    duration?: number;
    offset?: CoordinateOffset;
    scrollable?: Element;
    userCanInterrupt?: boolean;
    weCanInterrupt?: boolean;
}

Properties

altOffset?: CoordinateOffset

Offset the target coordinates by the given amount(s) when altTarget is used.

See ScrollToOptions.offset.

undefined
altTarget?: string | Element | TargetCoordinates

If the scrolling element is already at the given coordinates (or strictly speaking we allow for 5 pixels difference), then if altTarget is given, this will become the target to scroll to.

undefined
amount?: number

How much to scroll in the given direction.

100
asFractionOf?: "content" | "visible" | "pixel"

If set to "pixel" (default), amount is taken as absolute pixels.

If set to "visible", amount is taken as percent of the element's visible size in the scrolling direction (100 means full client width for horizontal or height for vertical scroll).

If set to "content", amount is taken as percent of the element's full content size in the scrolling direction (100 means full scroll width for horizontal or height for vertical scroll).

"pixel"
duration?: number

The duration of the scroll animation. If not given, it is instant.

0

Offset the target coordinates by the given amount(s).

E.g. if the final target coordinates are computed to be {top: 100, left: 0} and you specify offset as {top: 10, left: 20}, it will scroll to {top: 110, left: 20}.

undefined
scrollable?: Element

The element that should be scrolled.

If document.body is scrollable, will use that; otherwise document.scrollingElement

userCanInterrupt?: boolean

Whether a user attempt to scroll the target can interrupt this before it finishes.

false
weCanInterrupt?: boolean

Whether another request to us to scroll the same target can interrupt this scroll before it finishes.

false