Lock the body at a particular position and prevent scroll, uses margin on the scroll element to simulate original scroll position if @param setOffset is passed as true. Usually called when opening a modal or flyout, and you don't want the body scrolling behind the item.
Parameters:
Name | Type | Description |
---|---|---|
setOffset | boolean | Whether to apply the margin offset. |
- Since
- 1.0.0
- Source
Returns:
- Type:
- void
Example
import { bodyLock } from "@gravityforms/utils";
function Example() {
bodyLock.lock();
}