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.
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);
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)
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
enable: Enables all gesture capturing (default)
disable: Disables all gesture capturing