suomingxiang 4 месяцев назад
Родитель
Сommit
59d80febba
3 измененных файлов: 11 добавлений и 2 удалений
  1. 8
    2
      src/pages/intoTime/App.js
  2. 2
    0
      src/pages/intoTime/index.less
  3. 1
    0
      src/pages/socialResponsibility/App.js

+ 8
- 2
src/pages/intoTime/App.js Просмотреть файл

@@ -92,9 +92,15 @@ export default class App {
92 92
                             }
93 93
                         
94 94
                     });
95
-                    console.log(scrollY,ulScrolls);
95
+                    let documentHeight = document.documentElement.scrollHeight; // 文档总高度
96
+                    let viewportHeight = window.innerHeight; // 视口高度
97
+                    const heightThreshold = documentHeight - viewportHeight - 249; // 计算阈值
98
+                    let dom = document.querySelector('.timeYear')
99
+                    dom.style.opacity = (scrollY >= heightThreshold) ? '0' : '1';
100
+                   
101
+                    // console.log(scrollY,ulScrolls);
96 102
                     
97
-                } catch (error) { }
103
+                } catch (error) { console.log(error)}
98 104
             }
99 105
             window.addEventListener('scroll', updateScrollChange1);
100 106
         }

+ 2
- 0
src/pages/intoTime/index.less Просмотреть файл

@@ -32,6 +32,8 @@
32 32
     position: sticky;
33 33
     top: 170px;
34 34
     z-index: 2;
35
+    opacity: 1;
36
+    transition: all .1s;
35 37
     &>div{
36 38
       width: 212px;
37 39
       position: absolute;

+ 1
- 0
src/pages/socialResponsibility/App.js Просмотреть файл

@@ -49,6 +49,7 @@ export default class App {
49 49
                 tabs_ul[1].classList.add('tabs_lis')
50 50
                 news_ul.style.display = 'none';
51 51
                 typeCon.style.display = 'block';
52
+                this.fold()
52 53
             }else{
53 54
                 tabs_ul[0].classList.add('tabs_lis')
54 55
                 news_ul.style.display = 'block';

Загрузка…
Отмена
Сохранить