Hello,
Thanks for your Kind Patience!
We have made some changes to the code. Consider using the following JS Code:
[ch_pre]
const portfolioImages = document.querySelectorAll('.portfolio-item img');
const portfolioImageOptions = {
attributes: true,
attributeFilter: ['class'],
attributeOldValue: true
};
function callback(mutationList, observer) {
mutationList.forEach(function(mutation) {
// console.log( mutation );
if (mutation.type === 'attributes' && mutation.attributeName === 'class' && !mutation.oldValue.includes('lazy-loaded')) {
if( mutation.target.classList.contains('lazy-loaded') ) {
let portfolioImage = $(mutation.target),
portfolioItem = portfolioImage.parents('.portfolio-item'),
portfolioOverlay = portfolioItem.find('.sale-flash');
mutation.target.addEventListener('transitionend', () => {
portfolioOverlay.fadeIn();
});
}
}
});
}
const portfolioImageObserver = new MutationObserver(callback);
portfolioImages.forEach( image => portfolioImageObserver.observe(image, portfolioImageOptions) );
[/ch_pre]
and the following CSS Code:
[ch_pre type="css"].portfolio-item .sale-flash {
display: none;
}[/ch_pre]
This is working pretty well for us. Hope this Helps!
Let us know if we can help you with anything else or if you find any further issues.