react-stickyfill
Version:
React wrapper for Stickyfill library
32 lines (24 loc) • 605 B
Markdown
React wrapper for [Stickyfill](https://github.com/wilddeer/stickyfill) library
```
npm install react-stickyfill --save
```
Simple usage:
```js
import React, {Component} from 'react';
import Sticker from 'react-stickyfill';
class SomeComponent extend Component{
render() {
return (
<div>{/* Parent Element. */}
<Sticker>
<div>{/* Sticky Element */}</div>
</Sticker>
</div>
);
}
}
```
*Parent Element* should have height greater than *Sticky Element*. *Sticky Element* should have style `position: sticky` and `top: {some value}`.