1.1.0 • Published 8 years ago
react-scroll-context v1.1.0
react-scroll-context
A component to disable scroll on document body when its children are scrolled.
Install
yarn add react-scroll-contextor
npm install react-scroll-context --saveProps
enable: booleanset this to true if you want to manually disable scroll. Eg:enable: trueEnables scroll context and prevents scroll on document body.enable: falseDisables scrolls context and allows scroll on document body.
styles: stringString of classNames to be added to the parent container.
WARNING The mouse events will not work if the enable prop is set to either(true / false).
Help
- Uses mouse listeners for desktop / laptop browsers.
- For mobile devices set
enabledprop for enabling / disabling scroll context. - Takes care of jumps due to scrollbars on windows, linux etc.
Example
import ScrollContext from 'react-scroll-context';
function Component(props) {
return (
<ScollContext>
{// your awesome jsx}
</ScrollContext>
);
}License
MIT