gpt4 book ai didi

php - 如何在 JQuery 脚本中取消绑定(bind) JQZOOM?

转载 作者:行者123 更新时间:2023-12-01 07:35:28 25 4
gpt4 key购买 nike

我现在有这个脚本,它会在缩略图更改时更改图像。然后我希望将 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com