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

zoom-element

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

zoom-element

[![Status](https://img.shields.io/badge/status-active-success.svg)]() [![GitHub Issues](https://img.shields.io/github/issues/suhanbangera/arachnoid.svg)](https://github.com/spyder01/zoom-element/issues) [![GitHub Pull Requests](https://img.shields.io/gith

  • 0.1.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by150%
Maintainers
1
Weekly downloads
 
Created
Source

zoom-element

Status GitHub Issues GitHub Pull Requests License

A simplistic, compatible library to zoom and pan your elements.

Installation

Use NPM

npm install --save zoom-element
or

Use Yarn

yarn add zoom-element

Usage

This is how you create a simple zoom element.

import ZoomArea from 'zoom-element';

// Initialize element id to the class. It defaults to zoom-area.

const zoomArea = new ZoomArea('some-id', {
  minZoom: 0.3, // this defaults to 0.2
  maxZoom: 3.5, // this defaults to 2.5
  initialScale: 0.5, // this defaults to 1 
  zoomScale: 0.1, // this defaults to 0.1 
});

const ele1 = document.getElementById('element-1');
const ele2 = document.getElementById('element-2');
const ele3 = document.getElementById('element-3');

// this will zoom in the given element. 
zoomArea.zoomIn();


// this will zoom out the given element. 
zoomArea.zoomOut();

// this will reset the given element to its original size and position. 
zoomArea.reset();


// OTHER USE CASES

// Zoom In on click
ele1.onclick = zoomArea.zoomIn;

// Zoom out on click
ele2.onclick = zoomArea.zoomOut;

// Zoom reset on click
ele3.onclick = zoomArea.reset;

Keywords

FAQs

Package last updated on 05 Feb 2024

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