Jquery Zoom In Zoom Out

19,419

Here is a simple setup...

Check out this FIDDLE

var imagesize = $('img').width();

$('.zoomout').on('click', function(){
    imagesize = imagesize - 5;
    $('img').width(imagesize);
});

$('.zoomin').on('click', function(){
    imagesize = imagesize + 5;
    $('img').width(imagesize);
});
Share:
19,419
Daerik Fisher
Author by

Daerik Fisher

Updated on June 04, 2022

Comments

  • Daerik Fisher
    Daerik Fisher almost 2 years

    I'm trying to make a zoom in zoom out buttons that will zoom in and zoom out on a picture that is inside a div. The problem is when press the zoom in or zoom out the picture goes out from the div. I think I'm not doing it right.

    image.height = image.height+50
    image.width= image.height+50
    

    I would be grateful if anyone could give me any tips or code examples.