Awesome Open Source
Awesome Open Source

Zoom it!

Allows your users to zoom, rotate, and pan images using touch gestures.

For a DEMO open this on mobile:

Type Link Size
Minified 2184 bytes (gzip: 1024 bytes)
Debugging 10815 bytes

For an explanation of math see

Send pull requests, bug reports, and feature requests to


<div width=320 height=240 style="overflow:hidden;">
    <!-- this doesn't have to be an image -->
    <img id="torotate" width=320 height=240 src="">

<script type="text/javascript" src=""> </script>

The overflow:hidden is to crop the image moving outside the original border. Be creative. Hotlinking to may get you blocked; so copy to your own location.

var elem = document.getElementById('torotate');
var zm = new Zoom(elem, {
    rotate: true

// after use, call to remove event listeners, etc:

Pan cannot be currently disabled, there is an outstanding issue on it.

You can do operations like zm.reset() on this object, by default it attaches listeners to the object given.

Optionally pass a window-like object as the third parameter (e.g. for testing, or use in a non-browser environment).

If you are using NPM, then

var zoom = require("zoom-it");

var elem = document.getElementById('torotate');
var zm = new zoom.Zoom(elem, {
    rotate: true

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
javascript (70,847
javascript-library (216
touch (83
zoom (75
npm-module (48
rotate (27
pinch-to-zoom (20