<img class="tile-image clp-hover-img"
src="${product.images.medium[0].url}"
itemprop="image" data-src="${product.images.medium[0].hoverImageUrl}"/>
I am having issue with the image hover. Currently it is working fine but after ajax call, hover image won't work as expected. After page load, when I hover on the image, new hover image loads. When I select a new product using the swatch (AJAX), then it normally shows the new image. When I hover on it, it shows the old hover image itself.
Once I hover image on the container, hover image shows. After I select a new product (color but same product), image changes normally but the hover image will be showing the same of first product color.
var tempSrc = '';
$(".clp-hover-img").hover(function(){
tempSrc = $(this).attr('src');
$(this).attr("src", $(this).data("src"));
}, function(){
$(this).attr("src",tempSrc);
});