1111 |__/
1212```
1313
14- A simple library for image zooming; [ as seen on Medium] [ medium-zoom-article ] .
15-
16- This is a fork of the [ jQuery plugin by fat] [ fat-zoom ] . These are the key differences:
17-
18- 1 . No jQuery dependency; vanilla JavaScript only
19- 2 . Equivalent file size (the minified version is slightly smaller due to better
20- minification)
21- 3 . Includes bug fixes not present in the original, since the original is no
22- longer being maintained
23-
24- ** Live demo** : https://spinningarrow.github.io/zoom-vanilla.js
14+ ** Live demo** : [ zoom-vanilla.js in action] [ live demo ] .
2515
16+ A simple library for image zooming; [ as seen on Medium] [ medium-zoom-article ] .
2617It zooms in really smoothly, and zooms out when you click again, scroll away,
2718or press the <kbd >esc</kbd > key.
2819
2920If you hold the <kbd >⌘</kbd > or <kbd >Ctrl</kbd > key when clicking the image, it
3021will open the image in a new tab instead of zooming it.
3122
23+ _ This is a fork of the [ jQuery plugin by fat] [ fat-zoom ] _ . These are the key
24+ differences:
25+
26+ 1 . ** No jQuery dependency** ; vanilla JavaScript only
27+ 2 . ~ Equivalent~ smaller file size (the minified version is slightly smaller due
28+ to better minification)
29+ 3 . Includes bug fixes not present in [ fat/zoom.js] [ fat-zoom ] , which is no
30+ longer being maintained
31+
3232## Usage
3333
34- 1 . Download ` dist/zoom-vanilla.min.js ` and ` dist/zoom.css ` from GitHub, or
35- install via npm by running ` npm i zoom-vanilla.js ` .
34+ 1 . Download the JS and CSS files using any of the following methods:
35+
36+ - npm: `npm i -D zoom-vanilla.js`. This will download the the necessary
37+ files to the `node_modules/zoom-vanilla.js/dist/` directory.
38+
39+ - Directly link to the files hosted on a CDN:
40+
41+ - JS:
42+ https://cdn.jsdelivr.net/npm/zoom-vanilla.js/dist/zoom-vanilla.min.js
43+
44+ - CSS: https://cdn.jsdelivr.net/npm/zoom-vanilla.js/dist/zoom.css
45+
46+ - Manually download `dist/zoom-vanilla.min.js` and `dist/zoom.css` from
47+ GitHub
3648
37492 . Add the ` zoom-vanilla.min.js ` and ` zoom.css ` files to your HTML page:
3850
39- ``` html
40- <link href =" dist/zoom.css" rel =" stylesheet" > <!-- inside <head> -->
41- <script src =" dist/zoom-vanilla.min.js" ></script > <!-- before </body> -->
42- ```
51+ ``` html
52+ <!-- inside <head> -->
53+ <link href =" path/to/dist/zoom.css" rel =" stylesheet" >
54+
55+ <!-- before </body> -->
56+ <script src =" path/to/dist/zoom-vanilla.min.js" ></script >
57+ ```
4358
44593. Add a `data-action="zoom"` attribute to the images you want to make
4560 zoomable:
4661
47- ``` html
48- <img src =" img/blog_post_featured.png" data-action =" zoom" >
49- ```
62+ ```html
63+ <img src =" img/blog_post_featured.png" data-action =" zoom" >
64+ ```
5065
5166## Browser support
5267
@@ -71,3 +86,5 @@ an issue! Thanks!
7186- `npm run build` to build the minified JS and vendor-prefixed CSS
7287- `npm run watch` to rebuild when any JS files change (recommended for
7388 development)
89+
90+ [live demo]: http://code.sahil.me/zoom-vanilla.js
0 commit comments