You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An ambitious light-weight react module written in TypeScript for tracking scroll progress in a performant way. Developed for use with spring based animation libraries such as react-spring, but can be used with or without any library.
4
4
@@ -115,7 +115,7 @@ Configuration and properties:
115
115
116
116
-`scrollThrottle` - (number) throttles the recalculations to this value in ms when the element is scrolled.
117
117
-`resizeThrottle` - (number) throttles the recalculations to this value in ms when the element is resized.
118
-
-`scrollingElement` - (string, required) the selector for the main scrollable element to track scroll progress of.
118
+
-`scrollingElement` - (string/ref, required) the selector for the main scrollable element to track scroll progress of.
119
119
120
120
Creates a function which returns a `scrollData` object as such:
121
121
@@ -128,8 +128,9 @@ Creates a function which returns a `scrollData` object as such:
128
128
129
129
```js
130
130
<ScrollTrackerCustom
131
-
key={active.toString()} // forces a rerender of the tracker, use this if you for example hide the element with 'display: none'
132
-
scrollingElement='#custom-scroll-container'>
131
+
key={active.toString()} // forces a rerender of the tracker, use this if you for example hide the element with 'display: none' combined with a string based scrollingElement selector
132
+
scrollingElement='#custom-scroll-container'// this can also be a ref such as scrollingElement={scrollRef}
133
+
>
133
134
{({ scrollData }:ScrollData) => {
134
135
return (
135
136
// ScrollTracker components and other components can go inside here
@@ -210,4 +211,3 @@ If it still doesnt work then change the import string in the following fashion:
210
211
### Todo
211
212
212
213
-[ ] Implement the scroll logic for horizontal scrolling
213
-
-[ ] Refactor the ScrollTrackerCustom to handle both React refs and HTML elements
0 commit comments