Saltar al contenido principal

Function: useScrollToElement()

useScrollToElement(target, options?): boolean

Defined in: src/infrastructure/viewport/viewport.service.ts:201

Scrolls an element into view.

Parameters

target

string | HTMLElement

An HTMLElement or a CSS selector string.

options?

ScrollOptions = {}

Scroll options (behavior, block, inline).

Returns

boolean

true if the element was found and scrolled to.

Example

useScrollToElement("#section-2", { behavior: "smooth", block: "start" });