🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

zoom.js is a small proof of concept JavaScript library for zooming in on DOM elements or points in a document. It uses CSS3 transitions and 2D transforms (scaling, translation, transform origin) on the <body> element to achieve animated magnification.

Core Java Script CSS Zoom

Documentation

zoom.js

Enables a minimal JS API for zooming in on specific points or DOM elements.

Note that this is only a proof of concept so don't use it for anything important. Does not work in IE, yet.

Try out the demo.

Usage

Zoom in on an element:

  zoom.to({     element: document.querySelector( 'img' )   });

Additional options:

  zoom.to({     element: document.querySelector( 'img' ),      // Amount of empty space around zoomed element     padding: 20,      // Function to call once zooming completes     callback: function() { /* ... */ }   }); 

Zoom in on a point:

  zoom.to({     x: 100,     y: 200,     width: 300,     height: 300   });
  zoom.to({     x: 100,     y: 200,     scale: 3   });

Reset

  zoom.out();

License

MIT licensed

Copyright (C) 2017 Hakim El Hattab, http://hakim.se


You May Also Like