简体   繁体   English

jQuery Zoom插件?

[英]Jquery Zoom Plugin?

I seem to be having a difficult time finding a plugin that will zoom into my image while leaving the rest of the image at the same size. 我似乎很难找到一个可以放大我的图像,而其余图像保持相同大小的插件。

The reason why I need it is because I am using an image map and trying to zoom into the image on a particular continent. 之所以需要它,是因为我正在使用图像地图,并试图放大特定大陆上的图像。 Once zoomed in all the way I will replace the image I zoomed into with a new image and image map for that particular continent. 一路放大后,我将用该特定大陆的新图像和图像地图替换放大的图像。 I don't want the rest of the world map changing size when this is happening. 发生这种情况时,我不希望世界其他地方更改大小。

Does anyone know of a good plugin for this? 有谁知道一个好的插件吗?

I have found a tutorial that seems to demonstrate something close to what you want, along with instructions on how to get there: http://thecodeplayer.com/walkthrough/magnifying-glass-for-images-using-jquery-and-css3 我发现了一个教程,似乎在演示一些接近您想要的内容的方法,以及关于如何到达该位置的说明: http : //thecodeplayer.com/walkthrough/magnifying-glass-for-images-using-jquery-and-css3

Here's another: http://mlens.musings.it/ 这是另一个: http : //mlens.musings.it/

EDIT: Based on Justin's comment: 编辑:基于贾斯汀的评论:

What I am talking about here is an actual zooming animation. 我在这里谈论的是一个实际的缩​​放动画。 Not just merely replacing it as I could have done a fade in animation. 不仅可以替换它,而且还可以淡入淡出动画效果。

Use jQuery's animate() method to achieve this. 使用jQuery的animate()方法来实现这一点。

Code: 码:

$(function(){
    $('#zoomimage').click(function(){
        $(this).animate({height:'150%', width:'150%'}, 500);
    });
});​

EDIT: Based on Justin's next comment: 编辑:基于贾斯汀的下一条评论:

Hey Aditya, only problem is that the size is affected. 嘿Aditya,唯一的问题是尺寸会受到影响。 Is there a way to crop it as it grows so it stays the same size? 有没有办法随着它的生长而修剪它,使其保持相同的大小?

That can be done by manipulating the image's container to hide the rest of the image while it grows. 这可以通过操纵图像的容器以隐藏图像的其余部分来实现。 Something like this: 像这样:

<div style="width:275px; height:95px; overflow:hidden;">
    <img src="https://www.google.com/images/srpr/logo3w.png" id="zoomimage" />
</div>​

The overflow:hidden; overflow:hidden; ensures that the rest of the image does not show. 确保图像的其余部分不显示。

here's your solution, I use exactly the same also for map in my project, 这是您的解决方案,我的项目中的地图也使用完全相同的方法,

http://www.jacklmoore.com/zoom http://www.jacklmoore.com/zoom

Good luck :) 祝好运 :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM