Переглянути джерело

修改发展历程移动端

master
等你 2 місяці тому
джерело
коміт
408a1768ba
1 змінених файлів з 24 додано та 2 видалено
  1. 24
    2
      src/pages/index/App.js

+ 24
- 2
src/pages/index/App.js Переглянути файл

@@ -309,6 +309,21 @@ export default class App {
309 309
                         let numL=historySlides.length-this.activeIndex-1;
310 310
                         // fillLine.style.width=parseFloat(numL/historySlides.length)*100+"%";
311 311
                         fillLine.style.right=numL*fillLineWidth+'px';
312
+                        let nowSwiper=this.activeIndex;
313
+                        let year=parseInt(historySlides[nowSwiper].querySelector(".hisTime").textContent);
314
+                        let direction = nowSwiper > yearLin ? 'right' : 'left'; // 判断滑动方向
315
+                        console.log(direction, 'direction', year, defaultYear);
316
+                        
317
+                        yearLin=nowSwiper;
318
+                        if(direction=='left'&&year<defaultYear){
319
+                            let yearNew=defaultYear-10;
320
+                            defaultYear=yearNew;
321
+                            hisCk(yearNew)
322
+                        }else if(direction=='right'&&year>=defaultYear+10){
323
+                            let yearNew=defaultYear+10;
324
+                            defaultYear=yearNew;
325
+                            hisCk(yearNew)
326
+                        }
312 327
                     },
313 328
                 },
314 329
               });
@@ -389,8 +404,15 @@ export default class App {
389 404
             //     console.log(e,'dddd',maxYear,num,historySwiper.getTranslate());
390 405
             // });
391 406
             if(isMob){
392
-                historySwiper.slideTo(num);
393
-                
407
+                // historySwiper.slideTo(num);
408
+                historyTits.forEach((item,index)=>{
409
+                    let yearT=item.textContent.substring(0,4)*1;
410
+                    if(yearT==year){
411
+                        item.classList.add("active");
412
+                    }else{
413
+                        item.classList.remove("active");
414
+                    }
415
+                });
394 416
             }else{
395 417
                 let trnum=num*310;
396 418
                 let moveN=0;

Завантаження…
Відмінити
Зберегти