Skip to main content

Scroll event

Scroll values

PropertydefaultDescription
deviceType of device
activefalseWhether drag is active.
_activefalseWhether drag is active.
value[0, 0]Current position
_value[0, 0]Previous position
delta[0, 0]Delta of position
offset[0, 0]Offset of position
movement[0, 0]Movement of position
targetnullTarget element

Scroll events

Event nameArgumentDescription
scrollScrollStateCalled on all scroll events. Mainly events specified
scrollStartEventCalled only once when the scroll starts
scrollingEventCalled every time the scroll is moved
scrollEndEventCalled only once when the scroll ends
mountElementCalled when the component is mounted
cleannullCalled when the component is removed

Scroll state

export type Vec2 = [x: number, y: number]

export interface ScrollState<El extends Element = Element> {
_active: boolean
active: boolean
_value: Vec2
value: Vec2
delta: Vec2
offset: Vec2
movement: Vec2
target: El
event: Event
memo: any
isScrollStart: boolean
isScrolling: boolean
isScrollEnd: boolean
scroll(self: ScrollState<El>): void
scrollStart(e: Event): void
scrolling(e: Event): void
scrollEnd(e: Event): void
mount(target: El): void
clean(target: null): void
ref(traget: El | null): void
tick?: () => void
}