/youtube-lazy-load

Proper lazy loading on embedded YouTube Videos

Primary LanguageJavaScriptMIT LicenseMIT

youtube-lazy-load

Proper lazy loading on embedded YouTube Videos.

How-To

  1. 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>
  2. 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>
  3. 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.

Example

alterebro.github.io/youtube-lazy-load


@alterebro