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

745 Views Asked by At

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

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

1

There are 1 best solutions below

1
Akshay Vinod On
window.imageZoom.kill();
window.imageZoom = new ImageZoom(container,options);