最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Jquery Zoom In Zoom Out - Stack Overflow

programmeradmin6浏览0评论

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.

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.

Share Improve this question edited Nov 10, 2012 at 18:06 avpaderno 29.8k17 gold badges78 silver badges94 bronze badges asked Nov 10, 2012 at 17:55 Daerik FisherDaerik Fisher 2934 gold badges11 silver badges20 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

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);
});
发布评论

评论列表(0)

  1. 暂无评论