document.addEventListener("DOMContentLoaded", function () { const videos = document.querySelectorAll(".video"); const wrapper = document.querySelector('.videoWrapper'); const prevBtn = document.querySelector('.prev'); const nextBtn = document.querySelector('.next'); const dots = document.querySelectorAll('.dot'); let currentIndex = 0; videos.forEach(video => { const videoCover = video.nextElementSibling; videoCover.addEventListener("click", function () { if (video.paused) { video.play(); videoCover.style.display = "none"; } else { video.pause(); } }); video.addEventListener("pause", function () { videoCover.style.display = "block"; }); video.addEventListener("play", function () { videoCover.style.display = "none"; }); }); prevBtn.addEventListener('click', function() { if (currentIndex > 0) { currentIndex--; updateGalleryPosition(); } }); nextBtn.addEventListener('click', function() { if (currentIndex < videos.length - 1) { currentIndex++; updateGalleryPosition(); } }); function updateGalleryPosition() { const offset = -(currentIndex * 100) + "%"; wrapper.style.transform = `translateX(${offset})`; dots.forEach(dot => dot.classList.remove('active')); dots[currentIndex].classList.add('active'); } });advanza<studio> — Hongqi-KV-HS5