1.9.27 • Published 5 years ago

v-zoom v1.9.27

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

V-Zoom

A simple Javascript library for image zooming.

Demo

https://vdifoung.github.io/v-zoom/

Installation

NPM LINK

Installing a V-Zoom module

V-Zoom is delivered primarily via npm. (https://www.npmjs.com/package/v-zoom)

# using npm install
$ npm i v-zoom

Non-module environments

If, for any reason, you are constrained to a non-module environment (e.g. no bundlers such as webpack) - don’t fret. Just embed:

<script src="dist/js/v-zoom.min.js"></script>

Usage

If you’re using a bundler, e.g. webpack, you’ll need to import v-zoom.

import "v-zoom";

To create v-zoom instance.

VZoom.init("tagName", {options});
# Or
VZoom.init("#myID", {options});
# Or
VZoom.init(".className", {options});

Configuration is optional and passed in an object {}.

Usage example

VZoom.init("img", {
    zoomEffect: "translate",
    duration: "500",
    backgroundColor: "rgba(0,0,0,.95)"
});

Options

Config OptionTypeDefaultDescription
zoomEffectStringtranslate"translate" or "scale" Choose the zoom effect style.
durationNumber\|String279Time to execute (ms)
backgroundColorStringrgba(0.0.0.1)Background color. Example: "#000" or "rgba(0.0.0.1)"
scrollToCancelBooleantrueScrolling to cancel the image is being zoomed
zoomPercentageNumber5050%. Percentage of zoomed picture's size is compared with screen's size. To change zoom scale for each picture, use data-vzoom-scale="Number" attribute Example: <img src="img/thumbnail.png" data-vzoom-scale="1.95">

The v-zoom instance

// Retrieving the v-zoom instance
let vz = VZoom.init("img", {
    zoomEffect: "translate",
    duration: "500",
    backgroundColor: "rgba(0,0,0,.95)"
});

Methods

destroy()

vz.destroy();

Destroys the v-zoom instance, cleans up - removes event listeners, restores default, etc.

License

Licensed under MIT license, see LICENSE for the full license.

1.9.27

5 years ago

1.0.0

5 years ago

0.27.95

5 years ago

0.27.27

5 years ago

0.11.95

5 years ago

0.11.27

5 years ago

0.11.9

5 years ago

0.9.95

5 years ago

0.9.27

5 years ago

0.9.11

5 years ago

0.9.5

5 years ago

27.9.11

5 years ago

27.9.0

5 years ago