Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/body-scroll-lock

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/body-scroll-lock

TypeScript definitions for body-scroll-lock

  • 3.1.2
  • ts4.5
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @types/body-scroll-lock?

@types/body-scroll-lock provides TypeScript definitions for the body-scroll-lock library, which is used to prevent or allow scrolling on the body element of a webpage. This is particularly useful for modals, sidebars, and other UI elements that require the background content to be non-scrollable while they are open.

What are @types/body-scroll-lock's main functionalities?

Lock Body Scroll

This feature allows you to disable scrolling on the body element when a specific target element (e.g., a modal) is open. The code sample demonstrates how to import the `disableBodyScroll` function and apply it to a target element.

import { disableBodyScroll } from 'body-scroll-lock';

const targetElement = document.querySelector('#modal');
disableBodyScroll(targetElement);

Unlock Body Scroll

This feature allows you to re-enable scrolling on the body element when the specific target element (e.g., a modal) is closed. The code sample demonstrates how to import the `enableBodyScroll` function and apply it to a target element.

import { enableBodyScroll } from 'body-scroll-lock';

const targetElement = document.querySelector('#modal');
enableBodyScroll(targetElement);

Clear All Body Scroll Locks

This feature allows you to clear all scroll locks that have been applied to the body element. The code sample demonstrates how to import the `clearAllBodyScrollLocks` function and call it to remove all scroll locks.

import { clearAllBodyScrollLocks } from 'body-scroll-lock';

clearAllBodyScrollLocks();

Other packages similar to @types/body-scroll-lock

FAQs

Package last updated on 07 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc