how to zoom in an image using jquery

前端 未结 5 477
谎友^
谎友^ 2021-02-02 04:50

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 zoo

5条回答
  •  执念已碎
    2021-02-02 04:58

    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:

    
    
    
        Example
    
        
        
    
        
    
    
    
        

    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.

提交回复
热议问题