Interface IScrollToElementProps

Hierarchy

Properties

container?: IScrollLike | Element | Window

The container to scroll (window, element, or custom scroll-like object)

Default

window
duration?: number | ((lengthPx) => number)

The duration of the scroll animation in milliseconds. Can be either a fixed number or a function that takes the scroll distance and returns the duration.

Type declaration

    • (lengthPx): number
    • Parameters

      • lengthPx: number

      Returns number

Default

250
element: string | Element

The target element to scroll to.

left?: number

The target left position to scroll to, with optional padding.

Default

0
top?: number

The target top position to scroll to, with optional padding.

Default

0