A React component wrapper that restricts scrolling capabilities of everything except for its children
Check out the demo here!
npm install react-scroll-lock-component
import React, { Component } from 'react';
import ScrollLock from 'react-scroll-lock-component';
export default class extends Component {
render() {
return (
<div>
<ScrollLock> // when scrolling this div nothing else will scroll
<div>
...
</div>
</ScrollLock>
<div> // normal scrolling everywhere else
...
</div>s
</div>
);
}
}
- Fork it!
- 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 :D
Adapted from this old mixin
MIT