document.addEventListener("DOMContentLoaded",function(){var e=[].slice.call(document.querySelectorAll("img.lazy"));if("IntersectionObserver"in window){let n=new IntersectionObserver(function(e,t){e.forEach(function(e){if(e.isIntersecting){let t=e.target;t.src=t.dataset.src,t.classList.remove("lazy"),n.unobserve(t)}})});e.forEach(function(e){n.observe(e)})}});
Example
![]()
It will work in all image formate.... The Nitesh Arya
https://www.youtube.com/watch?v=-0YL7ylA-pA Rank Your Websites Fast with LazyLoad Image Javascript Code - Hindi - The Nitesh Arya