Zoom Image with Click to Increase Magnification jQuery Plugin

A lightweight jQuery plugin to easily zoom any part of an image on hover and increase magnification on click event.

This plugin depends on some other libraries to get working. These are Normalize CSS, MorphSVGPlugin JS and DrawSVGPlugin JS.

Plugin Overview

Plugin: Click to increase magnification
Author: Tom Miller
Licence: MIT Licence
Published: February 15, 2019
Official Website: Go to website
Dependencies: jQuery 1.3.1 or Latest version, Normalize CSS, MorphSVGPlugin JS and DrawSVGPlugin JS
File Type: zip archive (HTML, CSS & JavaScript)
Package Size: 1.21 MB

How to Use Zoom Image with Click:

1. Load the all necessary libraries including jQuery in HTML document.

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<!--TweenMax JS-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/2.0.2/TweenMax.min.js"></script>

<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/MorphSVGPlugin.min.js"></script>

<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/DrawSVGPlugin.min.js"></script>

2. Create Image box with div element that contains your image to zoom (magnify).

<div id="imgBox" class="group">
<img class="img group" src="image/forest.jpg">
<div class="svgWrapper">
<svg id="svgRoot" width="800" height="1200" version="1.1" xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink"></svg>
<defs id="defs">
<mask id="m1">
<circle id="masker" cx="0" cy="0" r="75" fill="#fff">
<g id="mag">
<circle cx="0" cy="2" r="75" fill="none" stroke="rgba(0,0,0,0.5)" stroke-width="4">
<img id="imgZoom" mask="url(#m1)" x="0" y="0" width="1200" height="1800" xlink:href="image/forest.jpg"></div>

3. And Finally load the click-to-increase-magnification javascript (jQuery) file and done.

<script src="js/index.js"></script>

Be the first to comment

Leave a Reply

Your email address will not be published.


18 − nine =

This site uses Akismet to reduce spam. Learn how your comment data is processed.