« get me outta code hell

so far so good - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/lazy-loading.js
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2020-10-28 18:01:59 -0300
committer(quasar) nebula <towerofnix@gmail.com>2020-10-28 18:01:59 -0300
commit33d67ffc4f9d9d0d7ad672997ffc5261770d988b (patch)
treebcb53a80baf13289dcd4c7b9bf9d490e13306171 /lazy-loading.js
parent25798012d6a0ab3ba0c439f372bbedc5943ac47e (diff)
so far so good
Diffstat (limited to 'lazy-loading.js')
-rw-r--r--lazy-loading.js25
1 files changed, 0 insertions, 25 deletions
diff --git a/lazy-loading.js b/lazy-loading.js
deleted file mode 100644
index 22f95eb0..00000000
--- a/lazy-loading.js
+++ /dev/null
@@ -1,25 +0,0 @@
-// Lazy loading! Roll your own. Woot.
-
-function loadImage(image) {
-    image.src = image.dataset.original;
-}
-
-function lazyLoad(elements) {
-    for (const item of elements) {
-        if (item.intersectionRatio > 0) {
-            observer.unobserve(item.target);
-            loadImage(item.target);
-        }
-    }
-}
-
-const observer = new IntersectionObserver(lazyLoad, {
-    rootMargin: '200px',
-    threshold: 1.0
-});
-
-for (const image of document.querySelectorAll('img.lazy')) {
-    observer.observe(image);
-}
-
-window.lazyLoadingExecuted = true;