Sticky divs with react
npm install react-stickydiv[React][1] Component that sets a div (or any HTML element) sticky when it's scrolled beyond view.
Demo at [http://learnreact.robbestad.com/#/stickydiv][2]
% npm install react-stickydiv --save
The compiled version of the script is automatically created by running:
make jsx
There's no need to update this manually.
#### Options
* {int} offsetTop - The offset from the top of the page, optional; default: 0
* {int} zIndex - The zIndex for the sticky element, optional; default: 999
* {function} onFixedChange - Function called on change on sticky state, optional;
* {string} className - A className (or names) for the sticky element, optional; default: ''
#### With JSX
var StickyDiv = require('react-stickydiv');
MyComponent = React.createClass({
render: function() {
return (
I'm Sticky
);
}
});
#### Without JSX
var MyComponent = React.createClass({
render: function() {
return React.createElement(StickyDiv, null, React.createElement("div", null, "I'm Sticky"));
}
});
[1]: https://facebook.github.io/react
[2]: http://learnreact.robbestad.com/#/stickydiv
[3]: https://github.com/svenanders/react-stickydiv/issues/1
[4]: https://gist.github.com/z5h/d95304d8d8e1fb6d0619