scrollStore

Reactive scroll position and state..

Demo

TopLeft
BottomLeft
TopRight
BottomRight
Scroll Me
X Position
Y Position
isScrolling
No
Top Arrived
No
Right Arrived
No
Bottom Arrived
No
Left Arrived
No
Scrolling Up
No
Scrolling Right
No
Scrolling Down
No
Scrolling Left
No

Usage

<script>
import { scrollStore } from 'svelte-legos'

let el;

$: myScroll = scrollStore(el);
$: x = $myScroll.x // usage $x => scrollLeft
$: y = $myScroll.y // usage $y => scrollTop
$: isScrolling = $myScroll.isScrolling // usage $isScrolling => boolean
$: arrivedState = $myScroll.arrivedState
$: directions = $myScroll.directions
</script>

<template>
  <div bind:this={el} />
</template>