youtube lazy
function lazyload_youtube_script()
{
if (is_front_page()) {
?>
document.addEventListener('DOMContentLoaded', function() { const lazyIframes = document.querySelectorAll('.lazy-youtube');</p><p> if ('IntersectionObserver' in window) { const observer = new IntersectionObserver((entries, observer) => { entries.forEach((entry) => { if (entry.isIntersecting) { const iframe = entry.target; iframe.src = iframe.dataset.src; observer.unobserve(iframe); } }); });</p><p> lazyIframes.forEach((iframe) => { observer.observe(iframe); }); } else { // Fallback for browsers that do not support Intersection Observer lazyIframes.forEach((iframe) => { iframe.src = iframe.dataset.src; }); } });
The post youtube lazy appeared first on We Said Go Travel.
Published on November 19, 2024 01:22
No comments have been added yet.
We Said Go Travel
Lisa Niver is the founder of We Said Go Travel and author of the memoir, Traveling in Sin. She writes for USA Today, Wharton Business Magazine, the Jewish Journal and many other on and offline publica
Lisa Niver is the founder of We Said Go Travel and author of the memoir, Traveling in Sin. She writes for USA Today, Wharton Business Magazine, the Jewish Journal and many other on and offline publications.
We Said Go Travel is a global community of over sixteen hundred writers with articles from every continent.
Stories are shared with photos and video from a perspective of the transformative power of travel. We Said Go Travel has hosted live and online events as well as travel writing contests around the world. ...more
We Said Go Travel is a global community of over sixteen hundred writers with articles from every continent.
Stories are shared with photos and video from a perspective of the transformative power of travel. We Said Go Travel has hosted live and online events as well as travel writing contests around the world. ...more
- Lisa Niver's profile
- 57 followers
