First, I integrate my Youtube video with a custom
divand custom thumbnail if needed. The data attribute tags are used to provide the Youtube video id and the custom thumbnail URL.
Finally, a click event listener is added to the placeholder to create an embed
iframewhen clicked. When showing the
iframethe placeholder is hidden.
The explanation is short and sweet, but take a look at the code and let me know what you think !
Youtube Custom Thumbnail Image: Cédric VT (@cedric_photography) from Unsplash
Cover Image: PJ Gal-Szabo (@pjgalszabo) from Unsplash