
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
scroll-zoom-clamp
Advanced tools
This DOM utility prevents zooming components from hijacking mouse-wheel events and interfering with the natural scroll of a page.
By wrapping a child element with this component, wheel events are only propagated downstream if a modifier key is pressed (ctrl or meta key - ⌘, ⊞), otherwise a message is overlayed informing the user to do so by pressing the key.
import ScrollZoomClamp from 'scroll-zoom-clamp';
or using a script tag
<script src="//unpkg.com/scroll-zoom-clamp"></script>
then
// assuming a parentNode and a childNode element
parentNode.appendChild(
new ScrollZoomClamp(childNode).node
);
new ScrollZoomClamp(childNode, { configOptions })
Creates a new scroll zoom protection, wrapped around the childNode
element.
The following configuration options are available:
Config option | Description |
---|---|
message: str | Ability to customize the message shown when the zoom is blocked. Supports plain text or HTML content. |
Type | Attribute | Description |
---|---|---|
Getter | node | Returns the wrapper DOM element. |
If this project has helped you and you'd like to contribute back, you can always buy me a ☕!
FAQs
Prevent page scrolling interference by zooming components
The npm package scroll-zoom-clamp receives a total of 112 weekly downloads. As such, scroll-zoom-clamp popularity was classified as not popular.
We found that scroll-zoom-clamp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.