Preview:
<script>
    document.addEventListener("DOMContentLoaded", function() {
      var lazyImages = document.querySelectorAll('.lazy-load');

      var options = {
        root: null,
        rootMargin: '0px',
        threshold: 0.5 // Adjust the threshold as needed
      };

      var observer = new IntersectionObserver(function(entries, observer) {
        entries.forEach(function(entry) {
          if (entry.isIntersecting) {
            var lazyImage = entry.target;
            lazyImage.src = lazyImage.getAttribute('src');
            lazyImage.classList.add('loaded');
            observer.unobserve(lazyImage); // Stop observing once the image is loaded
          }
        });
      }, options);

      lazyImages.forEach(function(img) {
        observer.observe(img);
      });
    });
  </script>
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter