1const tapas_element = document.getElementById('tapas-slider'); 2if (tapas_element) { 3 const slides = tapas_element.querySelectorAll('.swiper-slide'); 4 const numSlides = slides.length; 5 const isMobile = window.matchMedia("(max-width: 768px)").matches; 6 7 let perSlideOffset = 40; 8 if (numSlides === 2) { 9 perSlideOffset = 80; 10 } 11 12 const swiper_tapas = new Swiper(tapas_element, { 13 effect: 'cards', 14 grabCursor: true, 15 initialSlide: numSlides > 2 ? 1 : 0, 16 cardsEffect: { 17 perSlideOffset: isMobile ? 30 : perSlideOffset, 18 perSlideRotate: 1, 19 }, 20 navigation: { 21 nextEl: '.swiper-button-next', 22 prevEl: '.swiper-button-prev', 23 }, 24 pagination: { 25 el: '.swiper-pagination', 26 clickable: true, 27 }, 28 }); 29 30 swiper_tapas.on('slideChange', function () { 31 const activeIndex = swiper_tapas.realIndex; 32 ediciones.forEach((el) => el.classList.remove('active')); 33 ediciones[activeIndex].classList.add('active'); 34 }); 35 36 // Navegación desde la lista 37 const ediciones = document.querySelectorAll('.tapas__ediciones li'); 38 ediciones.forEach((edicion) => { 39 edicion.addEventListener('click', () => { 40 const slideIndex = parseInt(edicion.getAttribute('data-slide'), 10); 41 swiper_tapas.slideTo(slideIndex); 42 ediciones.forEach((el) => el.classList.remove('active')); 43 edicion.classList.add('active'); 44 }); 45 }); 46}
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.