Socket
Socket
Sign inDemoInstall

medium-zoom

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

medium-zoom

A JavaScript library for zooming images like Medium


Version published
Weekly downloads
123K
increased by11.82%
Maintainers
1
Weekly downloads
 
Created

What is medium-zoom?

The medium-zoom npm package provides a simple and elegant way to add zooming functionality to images on a webpage, similar to the zoom effect seen on Medium.com. It allows users to click on images to enlarge them, providing a better viewing experience.

What are medium-zoom's main functionalities?

Basic Zoom

This feature allows you to apply the zoom effect to all images on a webpage. By selecting all image elements and passing them to the mediumZoom function, users can click on any image to zoom in.

const mediumZoom = require('medium-zoom');
mediumZoom(document.querySelectorAll('img'));

Custom Options

This feature allows you to customize the zoom effect by providing options such as margin and background color. The margin option sets the space around the zoomed image, and the background option sets the color of the overlay.

const mediumZoom = require('medium-zoom');
mediumZoom(document.querySelectorAll('img'), { margin: 24, background: '#BADA55' });

Trigger Zoom Programmatically

This feature allows you to trigger the zoom effect programmatically. By calling the show method on the zoom instance, you can zoom in on the first image without user interaction.

const mediumZoom = require('medium-zoom');
const zoom = mediumZoom(document.querySelectorAll('img'));
zoom.show();

Attach Event Listeners

This feature allows you to attach event listeners to the zoom instance. For example, you can listen for the 'open' event to execute custom code when an image is zoomed in.

const mediumZoom = require('medium-zoom');
const zoom = mediumZoom(document.querySelectorAll('img'));
zoom.on('open', event => { console.log('Zoom opened', event); });

Other packages similar to medium-zoom

Keywords

FAQs

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