
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@threespot/freeze-scroll
Advanced tools
This script provides a cross-browser way of preventing scroll on the body element. A common use case for this is when a modal window is open. Without this script, it’s easy for users to unknowingly scroll the page behind the modal and be disoriented when it’s closed.
Inspired by https://benfrain.com/preventing-body-scroll-for-modals-in-ios/
Note: Once Safari and iOS Safari support the “touch-action” CSS property (caniuse.com), we can simply toggle a class that adds the following:
.js-no-scroll,
.js-no-scroll body {
overflow: hidden;
touch-action: none;
}
/* Create class to allow scrolling on certain elements, like modal windows */
.allow-scroll { touch-action: auto !important; }
yarn add @threespot/freeze-scroll
import scroll from "@threespot/freeze-scroll";
// Disable scrolling
scroll.freeze();
// Enable scrolling
scroll.unfreeze();
This is free software and may be redistributed under the terms of the MIT license.
Threespot is an independent digital agency hell-bent on helping those, and only those, who are committed to helping others. Find out more at https://www.threespot.com.
FAQs
Prevent scrolling
The npm package @threespot/freeze-scroll receives a total of 51 weekly downloads. As such, @threespot/freeze-scroll popularity was classified as not popular.
We found that @threespot/freeze-scroll demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.