CSS, Lazy Loading, JavaScript, Tutorial, Javascript Tips.
= +img.getAttribute('data-height') / +img.getAttribute('data-width'); img.style.paddingTop = ratio * img.getBoundingClientRect().width + 'px'; var lazy = new Image(); lazy.onload = function() { img.src = lazy.src; img.style.paddingTop = 0; img.classList.remove('loading');