- Fixed youtube play button in
.yt-lazyload-playbtn
and.yt-lazyload-playbtn:hover
. New SVG comes from youtube website. - Fixed SVG - removed charset utf8 from
background-image
as it is not required. Modifications in.yt-lazyload[data-logo="X"] .yt-lazyload-logo
- changed layout so that container maintains 16/9 ratio even if JS not loaded
- thumbnails are loaded as
background-image
using style attributes and CSS variables.
- rebuilt from scratch
- added lazyload (using Intersection Observer API - https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)
- youtube logo & link not added when
data-logo="0"
- important settings moved to variables at the beginning of JS file
- improved documentation
- DEMO - Bootstrap updated to v5
data-random=""
attribute was renamed to data-thumb=""
just to be more intuitive.
Change: <div class="yt-lazyload" data-id="XXXXXXXX" data-random="" data-logo="1">
to: <div class="yt-lazyload" data-id="XXXXXXXX" data-thumb="" data-logo="1">
If you don't like this change, change dataset.thumb
to dataset.random
in JS file.
- color logo now has 2 versions - color-dark and color-white (non-breaking change!)
- play button
background
properties moved from shorthand declaration tobackground-position
,background-size
,background-position
andbackground-image
. - play button svg had slightly incorrect shape. New image was taken directly from youtube website https://www.youtube.com/about/brand-resources/#logos-icons-colors
- play button dimensions now use
top:0;right:0;bottom:0;left:0;
instead ofwidth:100%;height:100%
- logo - new svg from https://www.youtube.com/about/brand-resources/#logos-icons-colors
- logo
background-size:100%
changed tobackground-size:contain
- removed
!important
from properties where it's unnecessary. It is added only to the most important CSS
- variable names updated to more consistent ones for easier development - prefix
yt_
was added to keep the code clean. This will be usefull in the future in case new and more advanced features will be added. - iframe source is now set using
element.src = ""
instead ofelement.setAttribute('src','');
- image
alt
attribute is now set usingelement.alt = ""
instead ofelement.setAttribute('alt','');
- improved documentation
- (#1) - Optimizing Links for Chrome Audits - added
rel = 'noreferrer'
EARLIER VERSIONS DISCARDED - USE v3.x.x