JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 510
  • Score
    100M100P100Q101414F
  • License MIT

A React component wrapper that restricts scrolling capabilities of everything except for its children.

Package Exports

  • react-scroll-lock-component

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-scroll-lock-component) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-scroll-lock-component

npm version Build Status

A React component wrapper that restricts scrolling capabilities of everything except for its children.

Wheel events, touchmove events, and key press events that affect page location (e.g. directional arrows, pageup/pagedown/spacebar) are all locked.

Demo

Check out the demo here!

Installation

npm install react-scroll-lock-component

or

yarn add react-scroll-lock-component

Usage

import React, { Component } from 'react';
import ScrollLock from 'react-scroll-lock-component';

export default () => {
    <div>
        <ScrollLock>
            <div> 
                {/*
                unlike normal scroll functionality, when the user scrolls this
                div and reaches the beginning or end nothing else on the page will scroll
                */}
            </div>
        </ScrollLock>
        <div>
            {/* scrolling elsewhere on the page will be normal */}
        </div>
      </div>
    );
}

Contributing

Please tag orteth01 as reviewer when you create a pull request

Credits

Adapted from this old mixin

License

MIT