useLockBodyScroll

React hook that locks scrolling on the body element. Useful for modal and other overlay components.

hooks
Description of the SVG image Loading...

About

Accepts ref object pointing to any HTML element as second parameter. Parent body element will be found and it's scroll will be locked/unlocked. It is needed to proper iFrame handling.

By default it uses body element of script's parent window.

Note: To improve performance you can pass body's or iframe's ref object, thus no parent lookup will be performed.

Installation

Run the following command:

npx ever-ui-clx@0.2.1 add demo-use-lock-body-scroll
# └──> Hook coming soon.

Usage