Kaynağa Gözat

修复bug

zjm
suomingxiang 4 ay önce
ebeveyn
işleme
54ee9bbfa1

+ 2
- 2
src/pages/common/tpl/header.tpl Dosyayı Görüntüle

@@ -39,7 +39,7 @@
39 39
                 </div>
40 40
             </div>
41 41
             <div class="menuOne">
42
-                <a href="">党建工作</a>
42
+                <a href="./partyBuilding.html">党建工作</a>
43 43
                 <div class="menuSon">
44 44
                     <div class="menuUp"></div>
45 45
                     <a href=""><span>企业党建</span></a>
@@ -47,7 +47,7 @@
47 47
                 </div>
48 48
             </div>
49 49
             <div class="menuOne">
50
-                <a href="">社会责任</a>
50
+                <a href="./socialResponsibility.html">社会责任</a>
51 51
                 <div class="menuSon">
52 52
                     <div class="menuUp"></div>
53 53
                     <a href=""><span>社会公益</span></a>

+ 59
- 61
src/pages/socialResponsibility/App.js Dosyayı Görüntüle

@@ -10,7 +10,7 @@ const pageSize = 5;
10 10
 
11 11
 export default class App {
12 12
     constructor() {
13
-        let common = new Common(document.querySelector('.main'),2)   //导航菜单高亮,0是首页,后面的按顺序添加
13
+        let common = new Common(document.querySelector('.main'),4)   //导航菜单高亮,0是首页,后面的按顺序添加
14 14
         this.isMobile = isMobile()
15 15
         this.num = 0;
16 16
         this.bindDom();
@@ -19,9 +19,9 @@ export default class App {
19 19
     }
20 20
 
21 21
     bindDom(){
22
-        const tabs_ul =  document.querySelectorAll(".tabs_li");
23
-        const news_ul =  document.querySelector(".news_ul");
24
-        const typeCon =  document.querySelector(".typeCon");
22
+        const tabs_ul = document.querySelectorAll(".tabs_li");
23
+        const news_ul = document.querySelector(".news_ul");
24
+        const typeCon = document.querySelector(".typeCon");
25 25
         
26 26
         tabs_ul.forEach((item,index)=>{
27 27
         
@@ -36,77 +36,75 @@ export default class App {
36 36
                 }else{
37 37
                     news_ul.style.display = 'none';
38 38
                     typeCon.style.display = 'block';
39
-                    this.fold()
39
+                    this.fold() 
40 40
                 }
41 41
                 // 给当前点击的元素添加 tabs_lis 类名
42 42
                 item.classList.add('tabs_lis');
43 43
             })
44 44
         })
45 45
     }
46
-    clearEvents(){
47
-        
48
-    }
46
+
49 47
     fold(){
50 48
         let isMobile=this.isMobile;
49
+        if(this.num == 0){
50
+            let liTitleArray = document.querySelectorAll('.liTitle');
51
+            liTitleArray.forEach((child )=>{
52
+                child.addEventListener('click', (event) => {
53
+                    // 获取被点击元素的父元素
54
+                    let parentElement = event.currentTarget.parentNode;
55
+                    let infoSonLi = parentElement.querySelector('.infoSonLi');
56
+                    let actualHeight = infoSonLi.offsetHeight;
57
+                    // 初始化子元素总高度
58
+                    let childrenTotalHeight = isMobile?30:0;
51 59
 
52
-        let liTitleArray = document.querySelectorAll('.liTitle');
53
-        liTitleArray.forEach((child )=>{
54
-            child.addEventListener('click', (event) => {
55
-                // 获取被点击元素的父元素
56
-                let parentElement = event.currentTarget.parentNode;
57
-                let infoSonLi = parentElement.querySelector('.infoSonLi');
58
-                let actualHeight = infoSonLi.offsetHeight;
59
-                // 初始化子元素总高度
60
-                let childrenTotalHeight = isMobile?30:0;
61
-
62
-                // 遍历所有子元素,累加它们的高度
63
-                Array.from(infoSonLi.children).forEach(child => {
64
-                    childrenTotalHeight += child.offsetHeight;
60
+                    // 遍历所有子元素,累加它们的高度
61
+                    Array.from(infoSonLi.children).forEach(child => {
62
+                        childrenTotalHeight += child.offsetHeight;
63
+                    });
64
+                    let totalHeight = actualHeight + childrenTotalHeight;
65
+                    if (parentElement.classList.contains("infoLiShow")) {
66
+                        parentElement.classList.remove('infoLiShow');
67
+                        gsap.to(infoSonLi,{height:0,duration:0.5})
68
+                    }else{
69
+                        parentElement.classList.add('infoLiShow');
70
+                        gsap.to(infoSonLi,{height:totalHeight,duration:0.5})
71
+                        // gsap.to(infoSonLi,{height:totalHeight,duration:1,onComplete: () => infoSonLi.style.height = 'auto'})
72
+                    }
65 73
                 });
66
-                let totalHeight = actualHeight + childrenTotalHeight;
67
-                if (parentElement.classList.contains("infoLiShow")) {
68
-                    parentElement.classList.remove('infoLiShow');
69
-                    gsap.to(infoSonLi,{height:0,duration:0.5})
70
-                }else{
71
-                    parentElement.classList.add('infoLiShow');
72
-                    gsap.to(infoSonLi,{height:totalHeight,duration:0.5})
73
-                    // gsap.to(infoSonLi,{height:totalHeight,duration:1,onComplete: () => infoSonLi.style.height = 'auto'})
74
-                }
75 74
             });
76
-        });
77
-        let typeTitCkArray = document.querySelectorAll('.typeTitCk');
78
-        let inFoul = document.querySelector('.infoul');
79
-        
80
-        let infoLiArray = document.querySelectorAll('.infoLi');
81
-        function addClassType() {
82
-            infoLiArray.forEach((val)=>{
83
-                val.classList.remove('infoLiShow');
84
-            })
75
+            let typeTitCkArray = document.querySelectorAll('.typeTitCk');
76
+            let inFoul = document.querySelector('.infoul');
77
+            
78
+            let infoLiArray = document.querySelectorAll('.infoLi');
79
+            function addClassType() {
80
+                infoLiArray.forEach((val)=>{
81
+                    val.classList.remove('infoLiShow');
82
+                })
83
+                typeTitCkArray.forEach((child )=>{
84
+                    child.classList.remove('ck');
85
+                });
86
+            }
87
+            //
88
+            let typeOld="all";
89
+            let element=document.querySelector('.typeTitle');
85 90
             typeTitCkArray.forEach((child )=>{
86
-                child.classList.remove('ck');
87
-            });
88
-        }
89
-        //
90
-        let typeOld="all";
91
-        let element=document.querySelector('.typeTitle');
92
-        typeTitCkArray.forEach((child )=>{
93
-            child.addEventListener('click', (event) => {
94
-                addClassType();
95
-                let domElement = event.target;
96
-                domElement.classList.add('ck');
97
-                let typeName = domElement.dataset.type;
98
-                inFoul.className = 'infoul '+ typeName;
99
-                if(isMobile){
100
-                    if(typeName=='type2'&&typeOld!='type3'){
101
-                        element.scrollLeft = element.scrollWidth - element.clientWidth;
102
-                    }else if(typeName=='type2'&&typeOld=='type3'){
103
-                        element.scrollLeft = 0;
91
+                child.addEventListener('click', (event) => {
92
+                    addClassType();
93
+                    let domElement = event.target;
94
+                    domElement.classList.add('ck');
95
+                    let typeName = domElement.dataset.type;
96
+                    inFoul.className = 'infoul '+ typeName;
97
+                    if(isMobile){
98
+                        if(typeName=='type2'&&typeOld!='type3'){
99
+                            element.scrollLeft = element.scrollWidth - element.clientWidth;
100
+                        }else if(typeName=='type2'&&typeOld=='type3'){
101
+                            element.scrollLeft = 0;
102
+                        }
104 103
                     }
105
-                }
104
+                });
106 105
             });
107
-        });
108 106
 
109
-        // if(this.num == 0){
107
+        
110 108
             //添加表单动画
111 109
             let liTits = document.querySelectorAll('.liTit');
112 110
             liTits.forEach((val)=>{
@@ -129,7 +127,7 @@ export default class App {
129 127
                 
130 128
             })
131 129
             this.num = 1;
132
-        // }
130
+        }
133 131
        
134 132
     }
135 133
     hotNews(){

Loading…
İptal
Kaydet