window.onload = function() {
  console.log("meow!");
  const images = document.querySelectorAll(".lazy-image");
  const options = {
    root: null,
    rootMargin: "-20px",
    threshold: 0.5
  };

  let observer = new IntersectionObserver(handleIntersect, options);
  images.forEach(image => {
    observer.observe(image);
  })

  function handleIntersect(entries) {
    entries.forEach(entry => {
      if (entry.intersectionRatio > 0) {
        let img = entry.target
        observer.unobserve(img);
        img.src = img.dataset.src;
        img.classList.add("fade-in");
      }
    })
  }

}

@@ -194,15 +194,71 @@
  %7D;%0A
-%0A
   let 
+observer;%0A%0A  if ('IntersectionObserver' in window) %7B%0A    
 obse
@@ -316,16 +316,18 @@
 tions);%0A
+  
   images
@@ -346,24 +346,26 @@
 ge =%3E %7B%0A    
+  
 observer.obs
@@ -379,18 +379,110 @@
 age);%0A  
+ 
+ 
 %7D)
+;%0A  %7D else %7B%0A    images.forEach(image =%3E %7B%0A      image.src = image.dataset.src;%0A    %7D)%0A  %7D
 %0A%0A  func
@@ -741,11 +741,10 @@
  %7D)%0A  %7D%0A
-%0A
 %7D%0A

load all images if instersectobserver is not supported