Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-scrolllock

Package Overview
Dependencies
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-scrolllock

Prevent scroll on the body when component is mounted.

  • 2.0.7
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

React Scroll Lock

Prevent scroll on the <body /> when a component is mounted.

Install

yarn add react-scrolllock

Usage

import ScrollLock from 'react-scrolllock';

class Modal extends Component {
  render() {
    return (
      <div>
        ...
        <ScrollLock />
      </div>
    );
  }
}

Props

PropertyDescription
accountForScrollbars booleanDefault: true -- Measures the scrollbar width and replaces it with padding when mounted.
touchScrollTarget HTMLElementDefault: null -- Touch scroll is locked for iOS when mounted due to overflow: hidden; not being observed on the <body/>. This property allows you to provide an element to allow scroll on, typically within a modal.

Keywords

FAQs

Package last updated on 28 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc