Sha256: 8363ce82c8839b9323ef036369c443c5c7ece77dcfcf52333907afea43ab9512

Contents?: true

Size: 340 Bytes

Versions: 22

Compression:

Stored size: 340 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');
    };
  });
}
module.exports = lazyLoad;

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
kcc-gem-theme-0.7.29 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.28 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.27 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.26 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.25 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.24 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.23 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.22 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.21 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.20 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.19 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.18 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.17 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.16 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.15 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.14 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.13 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.12 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.11 assets/js/theme/script/lazyLoad.js
kcc-gem-theme-0.7.10 assets/js/theme/script/lazyLoad.js