Sha256: ce0c47ca31d3a16f04b1cb7f9e107470f827df4fdbc083754aed2c021598d010
Contents?: true
Size: 391 Bytes
Versions: 24
Compression:
Stored size: 391 Bytes
Contents
// Lazy load images // ex. <img data-src="/path/to/image.jpg" alt=""> function lazyLoad() { [].forEach.call(document.querySelectorAll('img[data-src]'), function(img) { img.setAttribute('src', img.getAttribute('data-src')); img.onload = function() { img.removeAttribute('data-src'); }; }); } document.addEventListener('DOMContentLoaded', function() { lazyLoad(); });
Version data entries
24 entries across 24 versions & 1 rubygems