1// JavaScript Document 2 3const carousel = document.getElementById('nav-cover-carousel'); 4const prevButton = document.getElementById('nav-cover-prev'); 5const nextButton = document.getElementById('nav-cover-next'); 6 7let currentIndex = 0; 8 9function updateCarousel() { 10 const containerWidth = document.getElementById('nav-cover-carousel-container').offsetWidth; 11 const itemWidth = document.querySelector('.cover-carousel-item').offsetWidth; 12 const itemsToShow = Math.floor(containerWidth / itemWidth); 13 14 const totalItems = document.querySelectorAll('.cover-carousel-item').length; 15 const maxIndex = Math.max(0, totalItems - itemsToShow); 16 17 currentIndex = Math.min(currentIndex, maxIndex); 18 19 const newPosition = -currentIndex * itemWidth; 20 carousel.style.transform = `translateX(${newPosition}px)`; 21} 22 23prevButton.addEventListener('click', () => { 24 if (currentIndex > 0) { 25 currentIndex--; 26 } 27 updateCarousel(); 28}); 29 30nextButton.addEventListener('click', () => { 31 const totalItems = document.querySelectorAll('.cover-carousel-item').length; 32 const itemsToShow = Math.floor(document.getElementById('nav-cover-carousel-container').offsetWidth / document.querySelector('.cover-carousel-item').offsetWidth); 33 const maxIndex = Math.max(0, totalItems - itemsToShow); 34 35 if (currentIndex < maxIndex) { 36 currentIndex++; 37 } 38 39 updateCarousel(); 40}); 41 42window.addEventListener('resize', updateCarousel); 43 44// Initial call to set up the carousel 45updateCarousel(); 46 47 48 49
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.