Open mosaif opened 3 years ago
Hi @mosaif
How do you initialize blazy? Are you using the default setup where you need to add "b-lazy" as classname?
Hi @dinbror,
this is the initialization code. I am a total noob and I really appreciate your help.
`/**
Initialize lazy loading */ initLazyLoad: function () {
var options = {
selector: '.img-holder,.img-cont,.bs-lazy,img[data-src],iframe[data-src]',
itemLoaded: function (el, url) {
if (el.tagName.toLowerCase() === 'iframe' && $.fn.fitVids) {
$(el.parentNode).fitVids();
}
}
};
if (this.betterLazyLoad.isActive()) {
this.betterLazyLoad.init(options);
} else if ('function' === typeof Blazy) {
this.BLazyLoad(options);
}
this.likeBoxLazyLoad();
},
BLazyLoad: function (options) {
// Images
if (typeof Blazy !== "function") {
return;
}
Publisher_Theme.bsLazy = new Blazy({
selector: options.selector,
loadInvisible: function (ele, isVisible) {
if (!isVisible) {
while (ele = ele.parentElement) {
if (ele.className.match(/\bmega-menu\b/i)) {
return false;
}
}
}
return true;
},
successClass: ' ',
success: function (el) {
el.className = el.className + ' b-load-ready';
setTimeout(function () {
el.className = el.className.replace('b-load-ready', '') + ' b-loaded';
}, 100);
},
itemLoaded: function () {
if ($.fn.fitVids) {
$(this.parentNode).fitVids();
}
}
});
},`
Hi there,
The script is really good, but I've been trying to exclude the featured image class= "single-featured" from the lazy load but not success. Is there away to do it?