Skip to content

このページは翻訳の準備中のため、英語の原文を表示しています。

enableBodyScrollLock

enableBodyScrollLock is a utility function that locks the body scroll. It prevents the body from scrolling by applying fixed positioning. This is useful when opening modals, drawers, or other overlay components. Safe to call in SSR environment (no-op on server). Calling multiple times has no effect until unlocked.

Interface

ts
function enableBodyScrollLock(): void;

Parameters

Return Value

  • void

Example

tsx
// When modal opens
enableBodyScrollLock();

// When modal closes
disableBodyScrollLock();

MIT ライセンスの下で配布されています。