https://github.com/henrygd/hide-show-scroll
enables / disables html scroll without content jumping around. 184 bytes.
https://github.com/henrygd/hide-show-scroll
overflow scroll
Last synced: 12 months ago
JSON representation
enables / disables html scroll without content jumping around. 184 bytes.
- Host: GitHub
- URL: https://github.com/henrygd/hide-show-scroll
- Owner: henrygd
- License: mit
- Created: 2020-04-22T16:58:17.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-09-27T09:18:16.000Z (almost 2 years ago)
- Last Synced: 2025-07-10T11:15:43.812Z (12 months ago)
- Topics: overflow, scroll
- Language: JavaScript
- Homepage: https://henrygd.me/hide-show-scroll
- Size: 646 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# hide-show-scroll [![npm][npm-image]][npm-url] [![File Size][size-image]][cdn-url]
[npm-image]: https://img.shields.io/npm/v/hide-show-scroll.svg?style=flat
[npm-url]: https://www.npmjs.com/package/hide-show-scroll
[size-image]: https://img.badgesize.io/henrygd/hide-show-scroll/master/dist/hide-show-scroll.mjs?compression=gzip
[cdn-url]: https://github.com/henrygd/hide-show-scroll/blob/master/index.js
https://henrygd.me/hide-show-scroll
This won't work if the scrollbar is on an element other than html. May add that option in the future.
## Module Usage
```
$ npm install hide-show-scroll
```
```js
import { hideScroll, showScroll } from 'hide-show-scroll'
// lock scroll / hide html scrollbar
hideScroll()
// allow scroll / show html scrollbar
showScroll()
```
## Direct Script Usage
```html
```
```js
// lock scroll / hide html scrollbar
hideShowScroll.hideScroll()
// allow scroll / show html scrollbar
hideShowScroll.showScroll()
```
## License
MIT