if(typeof two_lazyLoadInstance === "undefined"){
window.two_lazyLoadInstance = new LazyLoad({
"callback_applied": function(element, instance){
let settings = instance._settings;
var bgDataValue = element.getAttribute("data-" + settings.data_bg_multi);
if (!bgDataValue) {
return;
}
if(window.getComputedStyle(element).getPropertyValue("background-image") !== bgDataValue) {
let style = element.getAttribute("style");
style += "background-image: " + bgDataValue + " !important;";
element.setAttribute("style", style);
}
}
});
}else{
two_lazyLoadInstance.update();
}
window.addEventListener("scroll", function() {
if(two_lazyLoadInstance.toLoadCount>0){
two_lazyLoadInstance.update();
}
});
/*
* Updates lazy-load instance from every ajax request
* When we use Ajax requests and get pictures back, we need to update lazy-load instance
* */
if (window.jQuery) {
jQuery.ajaxSetup({
complete: function() {
two_lazyLoadInstance.update();
}
});
}