Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 395127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:25:23+00:00 2026-05-12T16:25:23+00:00

I was just wondering how it’s possible to zoom in a pic using jquery,

  • 0

I was just wondering how it’s possible to zoom in a pic using jquery,

something like this web site,

link text

when you click on the big image it’ll zoom in and you can move your cursor and see the other part of the pic while zoomed in,

I’d appreciate it if someone could show me a link or put me in the right direction.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T16:25:24+00:00Added an answer on May 12, 2026 at 4:25 pm

    They don’t zoom in, what is really happening is that when you click the Zoom text, the image inside the div is replaced by a larger version of that image. And overflow is set to hidden.

    As you move your cursor, using some clever JavaScript and DOM handling, the image is simply moved relatively accordingly, creating the effect you are actually zooming in the picture.

    I’ll try to create up a simple example for you.

    EDIT

    Sorry took a while but here it is:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <title>Example</title>
    
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
        <script type="text/javascript">
            $(function() {
                    var fullWidth = 864; // Width in pixels of full-sized image
                    var fullHeight = 648; // Height in pixels of full-sized image
                    var thumbnailWidth = 389;  // Width in pixels of thumbnail image
                    var thumbnailHeight = 292;  // Height in pixels of thumbnail image
    
                    // Set size of div
                    $('#picture').css({
                            'width': thumbnailWidth+'px',
                            'height': thumbnailHeight+'px'
                    });
    
                    // Hide the full-sized picture
                    $('#full').hide();
    
                    // Toggle pictures on click
                    $('#picture').click(function() {
                            $('#thumbnail').toggle();
                            $('#full').toggle();
                    });
    
                    // Do some calculations
                    $('#picture').mousemove(function(e) {
                            var mouseX = e.pageX - $(this).attr('offsetLeft'); 
                            var mouseY = e.pageY - $(this).attr('offsetTop'); 
    
                            var posX = (Math.round((mouseX/thumbnailWidth)*100)/100) * (fullWidth-thumbnailWidth);
                            var posY = (Math.round((mouseY/thumbnailHeight)*100)/100) * (fullHeight-thumbnailHeight);
    
                            $('#full').css({
                                    'left': '-' + posX + 'px',
                                    'top': '-' + posY + 'px'
                            });
                    });
            });
        </script>
    
        <style type="text/css">
            #picture {
                    overflow: hidden;
                    position: relative;
                    border: 1px solid #000000;
            }
    
            #thumbnail {
                    cursor: pointer;
            }
    
            #full {
                    position: relative;
                    cursor: crosshair;
            }
        </style>
    </head>
    
    <body>
        <div id="picture">
            <img alt="" id="thumbnail" src="http://img202.imageshack.us/img202/8403/93629325.jpg" />
            <img alt="" id="full" src="http://img111.imageshack.us/img111/4734/tbmecsekyellowflower.jpg" />
        </div>
    </body>
    </html>
    

    You will need to adjust the thumbnail and full-sized image width and height accordingly. But simply copy paste the above to see an example of an image hosted on imageshack.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just wondering why people like case sensitivity in a programming language? I'm not trying
Just wondering which tool generated this git tree view? Thanks.
Just wondering of what people think of using MonoTorrent and the torrent protocol as
just wondering if anyone knows of a truly restful Put/delete implementation asp.net mvc preview
Just wondering if a .NET app can be compiled down to native machine code
Just wondering if there is an easy way to add the functionality to duplicate
Just wondering what the difference between BeginInvoke() and Invoke() are? Mainly what each one
Just wondering where is best to put functionality in an MFC application that is
Just wondering what little scripts/programs people here have written that helps one with his
Just wondering what the difference between MFC control messages prefixed with the following is:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.