R
fn

useWindowScroll

v0.0.15testeddemo

Reactive window scroll position with arrived/direction tracking. Writing to `x`/`y` scrolls the window.

Example

ts
const { x, y, isScrolling, arrivedState, directions } = useWindowScroll();

Demo

Loading demo…

Signature

ts
export function useWindowScroll(options: UseWindowScrollOptions ={ ... }

Parameters

ParameterTypeDescription
options?UseWindowScrollOptionsOptions

Returns

UseWindowScrollReturnReactive `x`, `y`, `isScrolling`, `arrivedState`, `directions` and a `measure()` helper