React Component that sets a div (or any HTML element) sticky when it's scrolled beyond view.
Demo at http://learnreact.robbestad.com/#/stickydiv
% 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.
- {int} offsetTop - The offset from the top of the page, optional; default: 0
- {int} zIndex - The zIndex for the sticky element, optional; default: 999
var StickyDiv = require('react-stickydiv');
MyComponent = React.createClass({
render: function() {
return (
<StickyDiv>
I'm Sticky
</StickyDiv>
);
}
});
var MyComponent = React.createClass({
render: function() {
return React.createElement(StickyDiv, null, React.createElement("div", null, "I'm Sticky"));
}
});