Untitled

mail@pastecode.io avatarunknown
plain_text
a month ago
875 B
1
Indexable
Never
 <div class="video-section">
    <div class="video-wrapper">
        <iframe data-src="https://www.youtube.com/embed/vr2PMQagF5E?rel=0&amp;mute=1&amp;loop=1"
                title="YouTube video player" frameborder="0"
                allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
                allowfullscreen></iframe>
    </div>
</div>
<script>
    const video = document.querySelector('iframe[data-src]');
    if (video) {
        const observer = new IntersectionObserver((entries, observer) => {
            entries.forEach(entry => {
                if (entry.isIntersecting) {
                    video.src = video.getAttribute('data-src');
                    observer.unobserve(video);
                }
            });
        });
        observer.observe(video);
    }
</script>