diff options
Diffstat (limited to 'src/static/lazy-loading.js')
-rw-r--r-- | src/static/lazy-loading.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/static/lazy-loading.js b/src/static/lazy-loading.js index 8f3e8cf5..1b779d26 100644 --- a/src/static/lazy-loading.js +++ b/src/static/lazy-loading.js @@ -33,16 +33,17 @@ function lazyLoadMain() { } var lazyElements = document.getElementsByClassName('lazy'); + var i; if (window.IntersectionObserver) { observer = new IntersectionObserver(lazyLoad, { rootMargin: '200px', threshold: 1.0, }); - for (var i = 0; i < lazyElements.length; i++) { + for (i = 0; i < lazyElements.length; i++) { observer.observe(lazyElements[i]); } } else { - for (var i = 0; i < lazyElements.length; i++) { + for (i = 0; i < lazyElements.length; i++) { var element = lazyElements[i]; var original = element.getAttribute('data-original'); element.setAttribute('src', original); |