A ReactJS wrapper for position:sticky elements using Stickyfill
npm install react-sticky-fillA ReactJS wrapper for position:sticky elements using the Stickyfill polyfill.
It can be installed as an npm package:
``bash`
$ npm install --save react-sticky-fill
You just import the Sticky component and pass your content as the single child:
`js
import React from 'react'
import Sticky from 'react-sticky-fill'
(
)
`
The necessary css is inlined, the polyfill is automatically added on mount.top (default: 0)
If you want to override (or any other css property), you can do so by passing a className or through style.
`js
import React from 'react'
import Sticky from 'react-sticky-fill'
(
I stick
)
(
I stick too
)
``
The component passes through every other prop, just like the ones shown above.
- position:sticky on caniuse.com
- Stickyfill