use-scroll-lock
Lock scroll at current position
Import
Source
Docs
Package
Usage
use-scroll-lock locks scroll at current position by setting document.body
overflow to hidden
.
Scrollbars offset
In some operation systems scrollbars have width.
To offset that width use-scroll-lock adds padding-right
equal to scrollbar width to body
element when scroll is locked.
However if you use elements with fixed
position you will need to add right padding manually: padding-right: var(--removed-scroll-width, 0px))
.