How to load images smoothly in lozad.js

73 views Asked by At

I have implemented lozad.js in one of my project but images getting load in multiple chunk loading which looks very odd,

Sometimes it load half image and then 1/3 image and then full, which look very bad on website

so i just wanted to load images smoothly, which will help to great User Experience

i have tried fade in but that makes my image hide, here is the below code

lozad('.lozad', {
    load: function(el) {
        el.src = el.dataset.src;
        el.onload = function() {
            el.classList.add('fade')
        }
    }
}).observe()
0

There are 0 answers