1var initSliderTimeline = async () => { 2 if (typeof Swiper != 'function') { 3 lazy.loadScript('/res/js/swiper/swiper-bundle.css') 4 await lazy.loadScript('/res/js/swiper/swiper-bundle.min.js') 5 } 6 7 setupTimeline() 8} 9 10function setupTimeline() { 11 document.querySelectorAll('.lazy-slider-timeline').forEach(item => { 12 // swiper 13 const slider = new Swiper(item.querySelector('.swiper'), { 14 loop: item.querySelectorAll('.swiper-slide').length > 1, 15 lazy: true, 16 speed: 600, 17 effect: 'slide', 18 navigation: { 19 prevEl: item.querySelector('.button-prev'), 20 nextEl: item.querySelector('.button-next'), 21 }, 22 on: { 23 slideChange: function () { 24 const activeIndex = this.realIndex 25 item.querySelectorAll('.timeline-menu button').forEach((btn, index) => { 26 btn.classList.toggle('active', index === activeIndex) 27 }) 28 } 29 } 30 }) 31 32 // menu 33 item.querySelectorAll('.timeline-menu button').forEach(btn => { 34 btn.addEventListener('click', e => { 35 const target = Number(e.currentTarget.getAttribute('data-target')) 36 item.querySelectorAll('.timeline-menu button').forEach(sibling => sibling.classList.remove('active')) 37 btn.classList.add('active') 38 slider.slideToLoop(target) 39 }) 40 }) 41 }) 42}
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.