Proper lazy loading on embedded YouTube Videos.
-
Add the
youtube-lazy-load.js
script to your web document<script src="https://cdn.jsdelivr.net/gh/alterebro/youtube-lazy-load/src/youtube-lazy-load.js"></script>
-
Create any link to your YouTube Video with the
data-youtube-lazy
attribute<a href="https://www.youtube.com/watch?v=xa_zPPsMMgo" data-youtube-lazy>YouTube Video</a>
-
Done! Your YouTube Videos will now lazy load. In the case that JavaScript isn't enabled on the browser, a link to your YouTube video will display.
→ alterebro.github.io/youtube-lazy-load