1// <-- !è½®æå¾å¼å§ --> 2const slider = document.getElementById('slider') 3const slides = slider.querySelectorAll('.slide') 4 5let currentIndex = 0 6let slideCount = slides.length 7let autoPlayInterval 8let isAutoPlay = true 9 10// 忢尿å®å¹»ç¯ç 11function goToSlide(index) { 12 if (index < 0) { 13 currentIndex = slideCount - 1 14 } else if (index >= slideCount) { 15 currentIndex = 0 16 } else { 17 currentIndex = index 18 } 19 20 slider.style.transform = `translateX(-${currentIndex * 100}%)` 21} 22 23// ä¸ä¸å¼ å¹»ç¯ç 24function nextSlide() { 25 goToSlide(currentIndex + 1) 26} 27 28// ä¸ä¸å¼ å¹»ç¯ç 29function prevSlide() { 30 goToSlide(currentIndex - 1) 31} 32 33// èªå¨ææ¾åè½ 34function startAutoPlay() { 35 if (isAutoPlay) { 36 autoPlayInterval = setInterval(() => { 37 nextSlide() 38 }, 5000) 39 } 40} 41 42// åå§åè½®æå¾ 43function initSlider() { 44 startAutoPlay() 45 46 // é¼ æ æ¬åæ¶æåèªå¨ææ¾ 47 slider.parentElement.addEventListener('mouseenter', () => { 48 if (isAutoPlay) { 49 clearInterval(autoPlayInterval) 50 } 51 }) 52 53 // é¼ æ ç¦»å¼æ¶æ¢å¤èªå¨ææ¾ 54 slider.parentElement.addEventListener('mouseleave', () => { 55 if (isAutoPlay) { 56 startAutoPlay() 57 } 58 }) 59} 60// åå§åè½®æå¾ 61initSlider() 62 63document.addEventListener('click', function (e) { 64 const el = e.target.closest('.sixth-block-box-title') 65 if (!el) return 66 el.querySelector('.sixth-block-box-title-img').classList.toggle('active') 67 el.nextElementSibling.classList.toggle('show') 68 document.querySelectorAll('.sixth-block-box-title').forEach(item => { 69 if (item !== el) { 70 item.querySelector('.sixth-block-box-title-img').classList.remove('active') 71 item.nextElementSibling.classList.remove('show') 72 } 73 }) 74})
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.