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
A modern, TypeScript-based React component for monitoring scroll events and triggering callbacks when elements enter, exit, or progress through the viewport. This is a rewritten and modernized version of the original react-scroll-trigger package.
8
10
@@ -87,15 +89,17 @@ Standard React props (className, style, etc.) are also supported and will be pas
87
89
## Technical Details
88
90
89
91
The component uses React hooks for efficient state management:
92
+
90
93
-`useRef` to track the DOM element position
91
94
-`useState` for viewport visibility and scroll tracking
92
95
-`useEffect` for handling scroll and resize events with proper cleanup
93
96
94
97
Visibility detection:
98
+
95
99
- Uses `getBoundingClientRect()` for accurate element position calculation
96
100
- Progress is calculated based on element's position relative to viewport:
0 commit comments