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

scroll-zoom-clamp

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scroll-zoom-clamp

Prevent page scrolling interference by zooming components

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

scroll-zoom-clamp

NPM package Build Size NPM Downloads

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.

Quick start

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
);

API reference

Instantiation

new ScrollZoomClamp(childNode, { configOptions })

Creates a new scroll zoom protection, wrapped around the childNode element.

The following configuration options are available:

Config optionDescription
message: strAbility to customize the message shown when the zoom is blocked. Supports plain text or HTML content.

Attributes

TypeAttributeDescription
GetternodeReturns the wrapper DOM element.

Giving Back

paypal If this project has helped you and you'd like to contribute back, you can always buy me a ☕!

Keywords

FAQs

Package last updated on 07 Dec 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