CSS, Lazy Loading, JavaScript, Tutorial, Javascript Tips.
change every time an image is loaded in we have to set an initial width, you can also do this with CSS. You want the img element to have the correct size before the image is even loaded. Now we fill the image to it’s correct size using Javascript. var img = document.querySelector('img[data-src]');