UseScrollTo
katanakit-js / useScrollTo
Function: useScrollTo()
Section titled “Function: useScrollTo()”function useScrollTo(x?, y?, behavior?): void;Defined in: infrastructure/viewport/viewport.service.ts:160
Scrolls the window to a specific position, respecting prefers-reduced-motion.
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
x? |
number |
0 |
Horizontal scroll target (default: 0). |
y? |
number |
0 |
Vertical scroll target (default: 0). |
behavior? |
ScrollBehavior |
"smooth" |
Scroll behavior (default: "smooth"). |
Returns
Section titled “Returns”void
Example
Section titled “Example”useScrollTo(0, 500); // scroll to 500px from top