当关闭弹出窗口时,Lazysizes + lightGallery错误加载图像

时间:2019-06-09 08:01:05

标签: javascript html loadimage lightgallery lazyload

我正在使用Lazysizes + lightGallery加载图像。但是,当打开弹出窗口时,[src]也发生了改变

这是配置js Lazysizes:

window.lazySizesConfig = window.lazySizesConfig || {};
window.lazySizesConfig.init = false;
window.lazySizesConfig.loadMode = 1;
window.lazySizesConfig.expand = 0;
window.lazySizesConfig.expFactor = 1.4;
window.lazySizesConfig.hFac = 0.4;
window.addEventListener("load", function() {
   lazySizes.init();
});

这是HTML:

<img width="500" height="500" class="asi-img lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mO8XA8AAisBVHpjGM0AAAAASUVORK5CYII=" data-src="src.jpg" ">

这是HTML加载完成:

<img width="500" height="500" class="asi-img lazyloaded" src="src.jpg" data-src="src.jpg" alt="padagirlss" style="width: 204px; height: 205px; margin-left: -102px; margin-top: -102.5px;">

加载完成后的结果: enter image description here

这是HTML,当打开弹出窗口时:

<img width="500" height="500" class="asi-img lazyloaded" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mO8XA8AAisBVHpjGM0AAAAASUVORK5CYII=" data-src="src.jpg" alt="padagirlss" style="width: 205px; height: 205px; margin-left: -102.5px; margin-top: -102.5px;">

关闭弹出窗口后的结果: enter image description here

请帮助我!

非常感谢。

0 个答案:

没有答案