# prevent-scroll

> Reliably disable scrolling

Latest version **2.0.0** (published 2016-11-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install prevent-scroll
pnpm add prevent-scroll
yarn add prevent-scroll
bun add prevent-scroll
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2016-11-15 |
| First published | 2016-07-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Jmeas |
| Maintainers | jmeas |

## Links

- npm: https://www.npmjs.com/package/prevent-scroll
- Repository: https://github.com/jmeas/prevent-scroll
- Issues: https://github.com/jmeas/prevent-scroll/issues
- npm.io page: https://npm.io/package/prevent-scroll

## Recent versions

- 2.0.0 (latest) — 2016-11-15
- 1.0.3 — 2016-11-15
- 1.0.2 — 2016-07-02
- 1.0.1 — 2016-07-02
- 1.0.0 — 2016-07-01

## README

# prevent-scroll

Reliably disable scrolling

[![Travis build status](http://img.shields.io/travis/jmeas/prevent-scroll.svg?style=flat)](https://travis-ci.org/jmeas/prevent-scroll)
[![Test Coverage](https://codeclimate.com/github/jmeas/prevent-scroll/badges/coverage.svg)](https://codeclimate.com/github/jmeas/prevent-scroll)
[![Dependency Status](https://david-dm.org/jmeas/prevent-scroll.svg)](https://david-dm.org/jmeas/prevent-scroll)
[![devDependency Status](https://david-dm.org/jmeas/prevent-scroll/dev-status.svg)](https://david-dm.org/jmeas/prevent-scroll#info=devDependencies)

### Motivation

Preventing a user from scrolling is a surprisingly challenging thing to do on
the web. This library is the most robust solution I know of to disable
scrolling.

### Features

✓ Mobile and desktop support  
✓ Prevents scrolling through keyboard inputs  
✓ Never loses the position of the scrollbar  
✓ Never causes the scrollbar to appear or disappear unnecessarily  
✓ Solid browser support  
✓ Zero dependencies

### Installation

The recommended way to install this package is through npm.

```
npm install prevent-scroll
```

### API

##### `preventScroll.on()`

Disables scrolling.

##### `preventScroll.off()`

Enables scrolling.

### Example Usage

```js
import preventScroll from 'prevent-scroll';

// Disable scrolling
preventScroll.on();

// Allow scrolling
preventScroll.off();
```

---
_Source: https://npm.io/package/prevent-scroll · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
