Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
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 309 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 1 open source maintainer 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.