svelte-zoom

1.0.16 • Public • Published

svelte-zoom

Nearly native image scaling (📱/💻), 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>

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.16
    135
    • latest

Version History

Package Sidebar

Install

npm i svelte-zoom

Weekly Downloads

136

Version

1.0.16

License

MIT

Unpacked Size

69.5 kB

Total Files

9

Last publish

Collaborators

  • vaheqelyan