$ npm install react-sticky-box
Sticky Boxes with sensible behaviour if the content is bigger than the viewport.
import StickyBox from "react-sticky-box";
const Page = () => (
<div className="row">
<StickyBox offsetTop={20} offsetBottom={20}>
<div>Sidebar</div>
</StickyBox>
<div>Content</div>
</div>
);
useStickyBox
hookimport {useStickyBox} from "react-sticky-box";
const Page = () => {
const stickyRef = useStickyBox({offsetTop: 20, offsetBottom: 20})
<div className="row">
<aside ref={stickyRef}>
<div>Sidebar</div>
</aside>
<div>Content</div>
</div>
};
cd /path/to/repo/packages/docs
yarn install && yarn start
this will allow you to modify the react-sticky-box sources in packages/react-sticky-box/src
and check the effects in the docs.
© 2010 - cnpmjs.org x YWFE | Home | YWFE