简体   繁体   English

页面加载后图像缩放工作,更改图库后,图像缩放不起作用

[英]Image zoom is working once the page load, after changing the gallery, image zoom is not working

Once the page load, code is working fine, after trying to change the set of images through ajax within same div, without refreshing the page, then zoom is not working页面加载后,代码工作正常,在尝试通过同一 div 内的 ajax 更改图像集后,没有刷新页面,然后缩放不起作用

I assigned a variable and set the zoom, then disable the zoom using destroy method, then again enabled the zoom..我分配了一个变量并设置了缩放,然后使用销毁方法禁用缩放,然后再次启用缩放..

    $(function(){
    var zoom;
     zoom = $(".rtwpvg-wrapper").find("img").magnify();
     $(".swatchinput").each(function(){
         $(this).click(function(){
            zoom.destroy();
            $(".rtwpvg-wrapper").find("img").magnify();
         });
     });
});

zoom Images should work even after replacing the images within same div即使在替换同一 div 中的图像后,缩放图像也应该可以工作

window.imageZoom.kill();
window.imageZoom = new ImageZoom(container,options);

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

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