« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/static/lazy-loading.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/static/lazy-loading.js')
-rw-r--r--src/static/lazy-loading.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/static/lazy-loading.js b/src/static/lazy-loading.js
index 8f3e8cf..1b779d2 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);