![]() |
How to use YouTube Video |
Table of Content
YouTube
Lazy loading is a technique used to defer the loading of resources, such as images and iframes, until they are needed. This improves the initial page load time and can help reduce data usage.
To implement lazy loading for a YouTube iframe, you can make use of the LazyLoad library. This library provides a simple way to lazily load iframes and other elements on your web page.
YouTube iframe Code :
<div class="media_player lyt" data-embed="XXXXXXXX">
<div class="play_button">
<svg viewbox="0 0 24 24">
<path d="M10 15l5.2-3L10 9v6m11.6-7.8a8.4 8.4 0 0 1 .2 1.9 16.2 16.2 0 0 1 .1 2.1v.8a25.1 25.1 0 0 1-.4 4.8 2.7 2.7 0 0 1-1.8 1.8l-2.6.2H12a50.8 50.8 0 0 1-7.8-.4 2.7 2.7 0 0 1-1.8-1.8 8.4 8.4 0 0 1-.2-1.9 16.2 16.2 0 0 1-.1-2.1V12a25.1 25.1 0 0 1 .4-4.8 2.7 2.7 0 0 1 1.7-1.8 12.6 12.6 0 0 1 2.6-.2H12a50.8 50.8 0 0 1 7.8.4 2.7 2.7 0 0 1 1.8 1.6z"></path>
</svg>
</div>
</div>
The parts XXXXXXXX marked yellow are replaced with the embed code from the YouTube video.
Example: https://www.youtube.com/embed/XXXXXXXX
Post a Comment