Super simple component for making things stick to the top of the screen when scrolling past them. Especially useful for menus!
import StickyMenu from './components/StickyMenu'
class App extends Component {
render() {
return (
<div className="App">
<div className='cover'>
<h1>This is a landing page</h1>
</div>
<StickyMenu>
<div className='header'>
<h1>This is a sticky menu</h1>
</div>
</StickyMenu>
<div className='about'>
<h1>This is a about section</h1>
</div>
<div className='contact'>
<h1>This is a contact section</h1>
</div>
</div>
);
}
}
Use the
<StickyMenu>
component to wrap elements to stick to the top of the page when scrolled past.
npm run start
or if you're using yarn
yarn start
- Fork it and create your feature branch: git checkout -b my-new-feature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Submit a pull request