Follow this blog

Monday, July 25, 2011

jQuery picture zoom

How to make jQuery picture zoom effect in a simple way. This jQuery image zoom effect you can easy add to your web or maybe to blogger's post. On this blog you can find more useful jscript effect tutorials.

Let's first take a look how jQuery picture zoom look like:




So when visitor hover a mouse over small picture zoom portion of that image appeared on right side with help of jQuery. On mouseover, image is zoomed! I believe that this is one of the simplest implementation of picture zoom effect you can find on Internet.

To accomplish picture zoom with jQuery like in demo you need to add this code on your web page:


<script src="[PathToJqueryFile]" type="text/javascript"></script>

<script src="[PathTojqzoomFile]" type='text/javascript'></script>

<script type="text/javascript">

    $(function () {
        var options =
{
    zoomWidth: 275,
    zoomHeight: 275
}
        $(".jqzoom").jqzoom(options);

        var options2 =
{
    zoomWidth: 275,
    zoomHeight: 275,
    zoomType: 'reverse'
}

        $(".jqzoom2").jqzoom(options2);

    });
</script>
<!--JQZOOM-STOPS-HELP@-http://bloggerstop.net-->

<a href="[PathToBiggerImage]" class="jqzoom" style="" title="Paris">

  <img src="[PathToSmallerImage]"  title="kawasakigreen" style="border: 1px solid #666;"><br />
</a>


You can copy code above and replace green words with real values:

  • [PathToJqueryFile] - path to jquery-1.3.2.min.js file. You must have this file to implement any jQuery functionality on your web site. You can download this file here.

  • [PathTojqzoomFile] - path to jquery.jqzoom1.0.1.js file. This file is needed for zoom functionality. You can download this file here.

  • [PathToBiggerImage] - path to image that will be displayed as a zoomed part of picture (in example it is zoomed portion of image which appear on the right side of the screen)

  • [PathToSmallerImage] - path to image that will be displayed as a image that you can move cursor over it (in example this is left picture)



In the end, here is some real code that works but please use it just for testing purpose. If you want to implement jquery picture zoom fuctionallity on you page, please, do not use paths you find on demo code below but download jqury files and upload them somewhere.


<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="http://nikofer.opendrive.com/files/54142960_wVVW5/jquery.jqzoom1.0.1.js" type='text/javascript'></script>

<script type="text/javascript">

    $(function () {
        var options =
{
    zoomWidth: 275,
    zoomHeight: 275
}
        $(".jqzoom").jqzoom(options);

        var options2 =
{
    zoomWidth: 275,
    zoomHeight: 275,
    zoomType: 'reverse'
}

        $(".jqzoom2").jqzoom(options2);

    });
</script>
<!--JQZOOM-STOPS-HELP@-http://bloggerstop.net-->

<a href="https://lh3.googleusercontent.com/-9akl-4Xf3Rk/TyHBLXlctII/AAAAAAAAA1w/xKfe6wtvOmg/s800/SealSmall.jpg" class="jqzoom" style="" title="Paris">

  <img src="https://lh6.googleusercontent.com/-F6xj8uQ3I5Q/TyHBK3ZN57I/AAAAAAAAA1s/b-u4OHLnzmc/s144/SealBig2.JPG"  title="kawasakigreen" style="border: 1px solid #666;"><br />
</a>

No comments: