Unlocks scrolling on the document body, restoring original styles.
Restores the overflow and padding-right styles that were saved when lockBodyScroll was called, then removes the data-* state attributes.
overflow
padding-right
lockBodyScroll
data-*
Does nothing if the body is not currently scroll-locked.
void
// ES Moduleimport { unlockBodyScroll } from '@bnidev/js-utils'// CommonJSconst { unlockBodyScroll } = require('@bnidev/js-utils') Copy
// ES Moduleimport { unlockBodyScroll } from '@bnidev/js-utils'// CommonJSconst { unlockBodyScroll } = require('@bnidev/js-utils')
// Unlock scroll (e.g., when closing a modal)unlockBodyScroll() Copy
// Unlock scroll (e.g., when closing a modal)unlockBodyScroll()
Unlocks scrolling on the document body, restoring original styles.
Restores the
overflowandpadding-rightstyles that were saved whenlockBodyScrollwas called, then removes thedata-*state attributes.Does nothing if the body is not currently scroll-locked.