jqzoom 对多个图像进行缩放
我有一张主图像和多个缩略图的标准设置,可以单击这些缩略图来更改主图像。我在主图像上使用 jqzoom,但遇到了主图像更改和缩放图像变成空白的常见问题。通过查看堆栈溢出,我发现了一些声称可以纠正此问题的代码,并且在某种程度上确实如此。但它并没有允许每个更改的图像进行缩放,而是使主图像只是到大版本的链接,绕过 jqzoom 函数调用。
显示两个示例: 使用标准 jqzoom 代码和缩略图不显示缩放: http://designerspider.net/clients/jge/project2.php?id=17
添加的代码和图像刚刚成为链接: http://designerspider.net/clients/jge/project.php?id=17
我添加的代码是
$(".thumbs a").click(function(){
$(".jqclass").unbind();
$(".jqclass").jqzoom(options);
return false;
};
如果有人可以看到我是否错过了任何内容,或者需要以不同的方式进行操作,我将不胜感激。我不明白为什么添加额外的功能会禁用主要的 jqzoom 功能:/
I have the standard setup of one main image and multiple thumbnails which can be cliced to change the main image. I'm using jqzoom on the main image but was having the common problem of the main image changing and the zoomed image just going blank. Looking through stack overflow i found some code that claimed to correct this, and in a way it does. But rather than allow each changed image to have a zoom, it makes the main image just a link to the large version, bypassing the jqzoom function call.
to show the two examples:
with the standard jqzoom code and thumbnails not showing zooms:
http://designerspider.net/clients/jge/project2.php?id=17
with added code and images just becoming links:
http://designerspider.net/clients/jge/project.php?id=17
the code i added was
$(".thumbs a").click(function(){
$(".jqclass").unbind();
$(".jqclass").jqzoom(options);
return false;
};
if anyone can see if i have missed anything, or need to do it a diffferent way, i'd appreciate any and all advice. I can't understand why adding the extra function would disable the main jqzoom feature :/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能会发现,由于您同时使用两个功能,一个用于更改图像,另一个用于取消绑定缩放功能,然后重新绑定它,所以第二个功能在图像更改之前完成。所以当图像确实改变时,它仍然不起作用。
第二个问题,你实际上并没有解除任何东西的绑定。
因此,首先尝试更改为:
或者,您可以将更多内容迁移到 jQuery。我已经测试过这个:
你的 HTML 看起来像这样:
你的 jQuery 像这样,我已经解释了每一行:
You may find, because you are using two functions side by side, one to change images, and the other to unbind the zoom function, and then rebind it, the 2nd function is finishing before the image has changed. So when the image does change, it still won't work.
Second problem, you are not actually unbinding anything.
So, try firstly changing to:
Alternatively you could migrate a little more to jQuery. I have tested this:
You HTML would look like this:
And your jQuery like this, I've explained each line:
这是从 jQZoom 中清理数据的方法:
因为 jQZoom 按以下方式保存对象数据:
This is how you can clean the data from jQZoom:
Because jQZoom saves the object data the following way: