Socket
Socket
Sign inDemoInstall

svelte-zoom

Package Overview
Dependencies
0
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    svelte-zoom

Nearly native image scaling in web (mobile/desktop), rich in functionality. This will make your mobile users happy


Version published
Weekly downloads
235
decreased by-2.49%
Maintainers
1
Install size
67.9 kB
Created
Weekly downloads
 

Readme

Source

svelte-zoom

Nearly native image scaling (:iphone:/:computer:), rich in functionality. It is extremely easy to use. it's built by comparing scaling features existing in 'Gallery' apps for smartphones. It doesn't seem slow, but it doesn't seem ridiculously fast either, to be honest, I didn't measure performance. This will also boost your mobile app and website user experience.

Preview

Note

The image must take up the entire width and height of the page

Features


Mobile
  • Pinch
  • Pan
  • Touch move
Desktop
  • Mouse wheel
  • Mouse move
General
  • Maximum scaling value calculated automatically
  • The image is limited by its aspect ratio
  • It is lightweight
  • It feels "native"

Installation

via NPM
npm i svelte-zoom

Usage

<Zoom src="URL" alt="..." />

Manual zooming

If for some reason you want to zoom in by calling the function manually. You can use the zoomIn and zoomOut functions. It will scale in the center of the image.

<script>
import Zoom from 'svelte-zoom'

let zoom;
</script>
<Zoom src="..." alt="..." bind:this={zoom} />

<button on:click={() => zoom.zoomIn()}>Zoom in</button>
<button on:click={() => zoom.zoomOut()}>Zoom out</button>

Keywords

FAQs

Last updated on 14 Aug 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc