作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我现在有这个脚本,它会在缩略图更改时更改图像。然后我希望将 JQZOOM 添加到该新图像中。但是,如果我将它放在 Onclick 事件中,单击它的次数越多,它就会变得越来越慢......我猜是因为它运行多个实例。
有没有办法将 JQZOOM 与某个东西解除绑定(bind),然后将其重新绑定(bind)到其他东西?
这是我现在的 jquery:
var options = {
zoomWidth: 400,
zoomHeight: 325,
xOffset: 25,
yOffset: 0,
position: "right",
lens: true,
zoomType: "reverse",
imageOpacity: 0.5,
showEffect: "fadein",
hideEffect: "fadeout",
fadeinSpeed: "medium",
title: false
};
$('.jqzoom').jqzoom(options);
$('.single-zoom-image').click ( function () {
$('#bigProductImage').attr("src", $(this).attr("zoom"));
$('.jqzoom').attr("href", $(this).attr("extrazoom"));
});
如果有人可以帮助我,请先致谢。
干杯!
最佳答案
这可以按如下方式完成:
修改jqzoom1.0.1.js其他鼠标功能所在的位置(第90行左右)
//Handle clicked thumbnails changing the zoomed image
$(this).bind('changeimage', function(){
smallimage = new Smallimage( $("img", this) );
largeimage = new Largeimage(a[0].href);
smallimage.loadimage();
});
按如下方式调用缩放器:
$(document).ready(function(){
var options = {
zoomWidth: 300,
zoomHeight: 200,
xOffset: 30,
yOffset: 0,
position: 'right',
title: false,
showPreload: false
};
//Handle clicking on the thumbnails, swap the mainimage and recycle the zoomer
$('.seemore').bind('click', function(e) {
e.preventDefault();
$('.jssProductFullImage').attr('src', $(this).attr('href'));
$('.zoomer').attr('href', $(this).attr('href') );
//Recall the zoomer to update the page
$('.zoomer').trigger('changeimage');
});
$('.zoomer').jqzoom(options);
});
关于php - 如何在 JQuery 脚本中取消绑定(bind) JQZOOM?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2334696/
我是一名优秀的程序员,十分优秀!