Last active
August 2, 2019 20:44
-
-
Save josephscott/ab9d7bc61b1f2134684400b4470e63c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener("DOMContentLoaded",function(){var e=[].slice.call(document.getElementsByClassName("js-lazy-img"));if("IntersectionObserver"in window){var t=new IntersectionObserver(function(e,s){e.forEach(function(e){if(e.isIntersecting){var s=e.target;s.src=s.dataset.src,s.dataset.srcset&&(s.srcset=s.dataset.srcset),t.unobserve(s)}})},{rootMargin:"250px 0px"});e.forEach(function(e){t.observe(e)})}else e.forEach(function(e){e.src=e.dataset.src,e.dataset.srcset&&(e.srcset=e.dataset.srcset)})}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment