Skip to content

jchonde/react-scroll-lock-component

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-scroll-lock-component

npm version

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

Demo

Check out the demo here!

Installation

npm install react-scroll-lock-component

Usage

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>
    );
  }
}

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Credits

Adapted from this old mixin

License

MIT

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.8%
  • Other 0.2%