I created a simple ReactJS plugin react-sticky-children
to abstract away the complexities of the IntersectionObserver API and allow you to apply styles to a component as it approaches the top of the viewport. Useful for "Scroll to Top", complex "sticky" elements or animating components into view.
Usage
import { ReactStickyChildren } from 'react-sticky-children';
<ReactStickyChildren initialStyle={initialStyle} intersectingStyle={intersectingStyle}>
<MyComponent />
</ReactStickyChildren>
Looking for feedback. 🙏
NPM: https://www.npmjs.com/package/react-sticky-children
GitHub: https://github.com/kevinfarrugia/react-sticky-children
Top comments (0)