Click here to Skip to main content
Click here to Skip to main content

JQzoom Image magnifier for Zooming Image

, 14 May 2014
Rate this:
Please Sign up or sign in to vote.
In this trick we are going to see image magnifying effect as seen on many e-commerce websites

In many e-commerce site (like flipkart,myntra etc), we have seen image zooming effect on mouse hovering the product image. In this article, we are going to see How to use JQZoom plugin for adding zoom effect to images.

Let's Start:

Firstly, Go to http://www.mind-projects.it/projects/jqzoom/ and Download the JQZoom plug-in. Extract the Files and copy js and css folder to the root directory of you project. In the Head tag of your webpage add Jquery and JQZoom plugin script. You can also attach the latest CDN from jquery site rather than using jquery-1.6.js version of jquery. Add jquery.jqzoom.css file in head tag.

<script src="js/jquery-1.6.js"></script>
<script src="js/jquery.jqzoom-core.js"></script>
<link href="css/jquery.jqzoom.css" rel="stylesheet" /> 

In this Example, I am going to use two jpeg images(one small thumbnail and one bigger).One Important thing is that the small picture(i.e. bikethumb.jpg) which is ging to be used as thumbnail is the scaled version of larger Image. Basically we want that on mouse hovering the small image larger image appear. And we are going to use class="minipic" in JQZoom script.

<a href="images/bike.jpg" class="minipic" title="Cartoon Bike"><img src="images/bikethumb.jpg" title="Bike"/></a>

Now we have to add another script tag which is used to call jqzoom function. We have passed some parameter in jqzoom function like zoomtype for type on effect on mouse hover the small pic.There are 6 types of ZoomType effect which we can use. Here we set lens true so that lens become visible on mouse hovering the small pic(i.e. bikethumb). We can also adjust zoom width and zoom height of the Magnified image.

<script type="text/javascript">
            $(document).ready(function () {
                $('.minipic').jqzoom({
                    zoomType: 'standard',
                    lens: true,
                    preloadImages: false,
                    alwaysOn: false,
                    zoomHeight: 200,
                    zoomWidth:200
                });
            });
</script>
Final Preview:

Hope you like it. Thanks

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Anoop Kr Sharma
Student
India India
No Biography provided
Follow on   Twitter

Comments and Discussions

 
GeneralMy vote of 4 PinmemberMember 1077162315-May-14 16:28 
GeneralRe: My vote of 4 PinpremiumAnoop Kr Sharma15-May-14 19:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140821.2 | Last Updated 14 May 2014
Article Copyright 2014 by Anoop Kr Sharma
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid