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: January 11, 2024
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.

<!--jQuery-->
<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>

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

<!--DrawSVGPlugin-->
<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">
</circle></mask>
</defs>
<g id="mag">
<circle cx="0" cy="2" r="75" fill="none" stroke="rgba(0,0,0,0.5)" stroke-width="4">
</circle></g>
<img id="imgZoom" mask="url(#m1)" x="0" y="0" width="1200" height="1800" xlink:href="image/forest.jpg"></div>
</div>

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

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

Leave a Comment

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

About CodeHim

Free Web Design Code & Scripts - CodeHim is one of the BEST developer websites that provide web designers and developers with a simple way to preview and download a variety of free code & scripts. All codes published on CodeHim are open source, distributed under OSD-compliant license which grants all the rights to use, study, change and share the software in modified and unmodified form. Before publishing, we test and review each code snippet to avoid errors, but we cannot warrant the full correctness of all content. All trademarks, trade names, logos, and icons are the property of their respective owners... find out more...

Please Rel0ad/PressF5 this page if you can't click the download/preview link

X