Skip to content

A fork of RTP PinchZoom free of jQuery dependencies.

License

Notifications You must be signed in to change notification settings

starsprung/VanillaPinch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VanillaPinch

VanillaPinch is a fork of PinchZoom.js with no jQuery dependency. The library provides multi touch gestures for zooming and dragging on any DOM element.

Finally, you are free of the shackles of jQuery! All you need is a modern browser.

Usage

The library exports a CommonJS module, and is designed for use with Browserify. For your conveience, a built version of VanillaPinch is included in dist/, which is a standalone Browserify bundle that assigns VanillaPinch on the global object.

var VanillaPinch = require('vanillapinch');

var myVanillaPinch = new VanillaPinch(document.querySelector('#your-element'), options);

Options


tapZoomFactor:      The zoom factor a double tap zooms to. (default 2)
zoomOutFactor:      Resizes to original size when zoom factor is below the configured value. (default 1.3)
animationDuration:  The animation duration in milliseconds. (default 300)
maxZoom:            The maximum zoom factor. (default 4)
minZoom:            The minimum zoom factor. (default 0.5)
lockDragAxis        Locks panning of the element to a single axis. (default false)

Events

Pinchzoom emits some custom events you can listen to


pz_zoomstart  Started to zoom
pz_zoomend    Stopped zooming
pz_dragstart  Started to drag the element
pz_dragend    Stopped to drag the element
pz_doubletap  Resetting the zoom with doubletab

Methods


enable:             Enables all gesture capturing (default)
disable:            Disables all gesture capturing

About

A fork of RTP PinchZoom free of jQuery dependencies.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 95.4%
  • HTML 2.9%
  • CSS 1.7%