CSS, Lazy Loading, JavaScript, Tutorial, Javascript Tips.
event (click, load, DOMContentLoad, etc.). var img = document.querySelector('img[data-src]'); var ratio = +img.getAttribute('data-height') / +img.getAttribute('data-width'); img.style.paddingTop = ratio * img.getBoundingClientRect().width + 'px'; var lazy = new Image(); lazy.onload = function() {