Flanger
Captivating wooshing effect by a rich “thru null” stereo flanger.
document.addEventListener("DOMContentLoaded", function () { var videos = document.querySelectorAll(".anwida-viewport-video"); if (!videos.length) { return; } function loadVideo(video) { if (video.dataset.loaded === "true") { return; } var sources = video.querySelectorAll("source[data-src]"); sources.forEach(function (source) { source.src = source.getAttribute("data-src"); source.removeAttribute("data-src"); }); video.load(); video.dataset.loaded = "true"; } function playVideo(video) { loadVideo(video); var playPromise = video.play(); if (playPromise !== undefined) { playPromise.catch(function () { /* Autoplay può essere bloccato in alcune condizioni. Il poster resta visibile, quindi va bene. */ }); } } function pauseVideo(video) { video.pause(); } if ("IntersectionObserver" in window) { var observer = new IntersectionObserver( function (entries) { entries.forEach(function (entry) { var video = entry.target; if (entry.isIntersecting) { playVideo(video); } else { pauseVideo(video); } }); }, { threshold: 0.25 } ); videos.forEach(function (video) { observer.observe(video); }); } else { /* Fallback browser vecchi: carica e prova a riprodurre subito. */ videos.forEach(function (video) { playVideo(video); }); } /* Se la tab diventa inattiva, ferma tutti i video */ document.addEventListener("visibilitychange", function () { if (document.hidden) { videos.forEach(function (video) { pauseVideo(video); }); } }); });