# no-scroll

> Disable the document's scrolling

Latest version **2.1.1** (published 2018-05-08) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types package; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.1 |
| Published | 2018-05-08 |
| First published | 2015-08-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/no-scroll) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 243 |
| Author | David Clark |
| Maintainers | davidtheclark |
| Keywords | scroll, scrolling, disable, modal, dialog |

## Links

- npm: https://www.npmjs.com/package/no-scroll
- Repository: https://github.com/davidtheclark/no-scroll
- Homepage: https://github.com/davidtheclark/no-scroll#readme
- Issues: https://github.com/davidtheclark/no-scroll/issues
- npm.io page: https://npm.io/package/no-scroll

## Alternatives

- [react-native-root-siblings](https://npm.io/package/react-native-root-siblings.md) — 102.9K weekly downloads
- [@praxisui/dialog](https://npm.io/package/@praxisui/dialog.md) — 2.0K weekly downloads
- [easy-toggle-state](https://npm.io/package/easy-toggle-state.md) — 350 weekly downloads
- [ngx-lightbox-evp](https://npm.io/package/ngx-lightbox-evp.md) — 19 weekly downloads
- [react-native-modal-translucent-axton](https://npm.io/package/react-native-modal-translucent-axton.md) — 4 weekly downloads

## Recent versions

- 2.1.1 (latest) — 2018-05-08
- 2.1.0 — 2017-04-29
- 2.0.0 — 2016-08-07
- 1.1.2 — 2015-12-17
- 1.1.1 — 2015-09-30
- 1.1.0 — 2015-09-30
- 1.0.2 — 2015-09-04
- 1.0.1 — 2015-08-30
- 1.0.0 — 2015-08-27
- 0.1.0 — 2015-08-23

## README

# no-scroll

Disable the document's scrolling.

It's silly how many libraries have their own implementation of this.
So I thought I'd make a module that other libraries could use.

Here's how this works:
- When you turn it `on()`, the `documentElement` is styled with `width: calc(100% - scrollbarSize)`, `position: fixed`, `top: currentScrollTop`, and `overflow: hidden`.
- When you turn it `off()`, everything goes back to the way it was before.

## Installation

```
npm install no-scroll
```

Dependencies: *none*.

## Browser Support

IE9+

## Usage

This module exposes three simple functions: `on()`, `off()` and `toggle()`.

```js
var noScroll = require('no-scroll');

// To turn off the document's scrolling
noScroll.on();

// To restore scrolling
noScroll.off();

// To toggle scrolling
noScroll.toggle();
```

If you do not have a CommonJS environment (no `module.exports`), the module
exposes the global object `noScroll`.

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