1/** 2 * 第åå±ä¸é¢ä¸æ å¨ç»æ§å¶ï¼æ 颿»å ¥ + è½®æå¾æ·¡å ¥ï¼ 3 */ 4class TopicsAnimation { 5 constructor() { 6 this.topicsTitle = null; 7 this.topicsCarousel = null; 8 this.currentSlideIndex = 0; 9 this.init(); 10 } 11 12 init() { 13 // çå¾ DOMå è½½å®æ 14 if (document.readyState === 'loading') { 15 document.addEventListener('DOMContentLoaded', () => this.setup()); 16 } else { 17 this.setup(); 18 } 19 } 20 21 setup() { 22 // è·åæ é¢å ç´ 23 this.topicsTitle = document.querySelector('.topics-content-title'); 24 // è·åè½®æå¾å®¹å¨å ç´ 25 this.topicsCarousel = document.querySelector('.loan-product-list'); 26 27 if (!this.topicsTitle) { 28 console.warn('Topics title element not found'); 29 return; 30 } 31 32 if (!this.topicsCarousel) { 33 console.warn('Topics carousel element not found'); 34 return; 35 } 36 37 // åå§ç¶æè®¾ä¸ºéè 38 this.hideTitle(); 39 this.hideCarousel(); 40 41 // çå¾ Swiperå®ä¾å¯ç¨ 42 this.waitForSwiper(); 43 } 44 45 waitForSwiper() { 46 const checkSwiper = () => { 47 if (window.mainSwiper) { 48 this.bindSwiperEvents(); 49 } else { 50 setTimeout(checkSwiper, 100); 51 } 52 }; 53 checkSwiper(); 54 } 55 56 bindSwiperEvents() { 57 // ç嬿»å¨äºä»¶ 58 window.mainSwiper.on('slideChange', () => { 59 this.currentSlideIndex = window.mainSwiper.activeIndex; 60 this.handleSlideChange(); 61 }); 62 63 // æ£æ¥åå§ç¶æ 64 this.currentSlideIndex = window.mainSwiper.activeIndex; 65 this.handleSlideChange(); 66 } 67 68 handleSlideChange() { 69 // 第åå±çç´¢å¼æ¯3ï¼ä»0å¼å§è®¡æ°ï¼ 70 if (this.currentSlideIndex === 3) { 71 this.showTitle(); 72 // è½®æå¾å»¶è¿0.5ç§åæ·¡å ¥ï¼è®©æ é¢å æ»å ¥ 73 setTimeout(() => { 74 this.showCarousel(); 75 }, 500); 76 } else { 77 this.hideTitle(); 78 this.hideCarousel(); 79 } 80 } 81 82 showTitle() { 83 if (this.topicsTitle) { 84 this.topicsTitle.classList.remove('slide-out'); 85 this.topicsTitle.classList.add('slide-in'); 86 } 87 } 88 89 hideTitle() { 90 if (this.topicsTitle) { 91 this.topicsTitle.classList.remove('slide-in'); 92 this.topicsTitle.classList.add('slide-out'); 93 } 94 } 95 96 showCarousel() { 97 if (this.topicsCarousel) { 98 this.topicsCarousel.classList.remove('fade-out'); 99 this.topicsCarousel.classList.add('fade-in'); 100 } 101 } 102 103 hideCarousel() { 104 if (this.topicsCarousel) { 105 this.topicsCarousel.classList.remove('fade-in'); 106 this.topicsCarousel.classList.add('fade-out'); 107 } 108 } 109} 110 111// å建å®ä¾ 112const topicsAnimation = new TopicsAnimation();
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.