Browse Source

修改

master
suomingxiang 1 month ago
parent
commit
07b63e7966

+ 4
- 0
dev/static/font/cavan.css View File

@@ -10,4 +10,8 @@
10 10
 @font-face {
11 11
     font-family: 'CrimsonTextBold';
12 12
     src: url('./CrimsonText-Bold-2.ttf') format('truetype');
13
+}
14
+@font-face {
15
+    font-family: 'DINBOLD';
16
+    src: url('./din-bold.ttf') format('truetype');
13 17
 }

BIN
dev/static/font/din-bold.ttf View File


+ 61
- 26
src/pages/HogoodCoffee/App.js View File

@@ -39,10 +39,45 @@ export default class App {
39 39
         //横屏滚动数组值
40 40
         this.busGrouds = [];
41 41
 
42
+        document.addEventListener('DOMContentLoaded', function () {
43
+            const menuItems = document.querySelectorAll('.menuOne');
44
+            const sections = document.querySelectorAll('div[id="m1"], div[id="m2"], div[id="m3"], div[id="m4"]'); // 获取所有带有 id 的 div
45
+
46
+            function updateMenu() {
47
+                let scrollPosition = window.scrollY; // 获取当前滚动位置
48
+                let foundActive = false; // 标记是否找到当前活动的菜单项
49
+                sections.forEach(section => {
50
+                    const sectionTop = section.offsetTop; // 获取当前 section 的顶部位置
51
+                    const sectionHeight = section.offsetHeight; // 获取当前 section 的高度
52
+                    // 检查当前 section 是否在视口内
53
+                    if (scrollPosition >= sectionTop && scrollPosition < sectionTop + sectionHeight) {
54
+                        // 移除所有菜单项的选中状态
55
+                        menuItems.forEach(item => item.classList.remove('menuClicked'));
56
+                        // 找到对应的菜单项并添加选中状态
57
+                        const correspondingMenuItem = Array.from(menuItems).find(item => {
58
+                            return item.querySelector('a').getAttribute('href') === `./HogoodCoffee.html#${section.id}`;
59
+                        });
60
+                        if (correspondingMenuItem) {
61
+                            correspondingMenuItem.classList.add('menuClicked');
62
+                        }
63
+                        foundActive = true; // 找到当前活动的菜单项
64
+                    }
65
+                });
66
+                // 如果没有找到活动的菜单项,默认选中第一个菜单项
67
+                if (!foundActive) {
68
+                    menuItems.forEach(item => item.classList.remove('menuClicked')); // 移除所有菜单项的选中状态
69
+                    menuItems[0].classList.add('menuClicked'); // 默认选中第一个菜单项
70
+                }
71
+            }
72
+            // 监听滚动事件
73
+            window.addEventListener('scroll', updateMenu);
74
+            // 初始化菜单状态
75
+            updateMenu(); // 页面加载时调用一次
76
+        });
42 77
         this.headerMenu();
43 78
         this.banner();
44 79
         this.init();
45
-        this.updateMenu()
80
+        // this.updateMenu()
46 81
     }
47 82
     banner() {
48 83
         // let isMob=this.isMobile;
@@ -169,31 +204,31 @@ export default class App {
169 204
 
170 205
     // 获取所有菜单项
171 206
     // 函数用于更新菜单状态
172
-    updateMenu() {
173
-        const menuItems = document.querySelectorAll('.menuOne');
174
-        // 获取当前锚点
175
-        const currentHash = window.location.hash;
176
-        // 遍历所有菜单项
177
-        if (!currentHash) {
178
-            // 移除所有菜单项的选中状态
179
-            menuItems.forEach(item => item.classList.remove('menuClicked'));
180
-            // 给第一个菜单项添加选中状态
181
-            menuItems[0].classList.add('menuClicked');
182
-        } else {
183
-            // 遍历所有菜单项
184
-            menuItems.forEach(item => {
185
-                item.classList.remove('menuClicked');
186
-                // 获取当前菜单项的 href
187
-                const link = item.querySelector('a').getAttribute('href');
188
-                // 如果当前菜单项的 href 与当前锚点匹配,则添加 menuClicked 类
189
-                if (link === `./HogoodCoffee.html${currentHash}`) {
190
-                    item.classList.add('menuClicked');
191
-                }
192
-            });
193
-        }
194
-        // 监听 hashchange 事件,当锚点变化时更新菜单状态
195
-        window.addEventListener('hashchange', this.updateMenu);
196
-    }
207
+    // updateMenu() {
208
+    //     const menuItems = document.querySelectorAll('.menuOne');
209
+    //     // 获取当前锚点
210
+    //     const currentHash = window.location.hash;
211
+    //     // 遍历所有菜单项
212
+    //     if (!currentHash) {
213
+    //         // 移除所有菜单项的选中状态
214
+    //         menuItems.forEach(item => item.classList.remove('menuClicked'));
215
+    //         // 给第一个菜单项添加选中状态
216
+    //         menuItems[0].classList.add('menuClicked');
217
+    //     } else {
218
+    //         // 遍历所有菜单项
219
+    //         menuItems.forEach(item => {
220
+    //             item.classList.remove('menuClicked');
221
+    //             // 获取当前菜单项的 href
222
+    //             const link = item.querySelector('a').getAttribute('href');
223
+    //             // 如果当前菜单项的 href 与当前锚点匹配,则添加 menuClicked 类
224
+    //             if (link === `./HogoodCoffee.html${currentHash}`) {
225
+    //                 item.classList.add('menuClicked');
226
+    //             }
227
+    //         });
228
+    //     }
229
+    //     // 监听 hashchange 事件,当锚点变化时更新菜单状态
230
+    //     window.addEventListener('hashchange', this.updateMenu);
231
+    // }
197 232
 
198 233
     headerMenu() {
199 234
         let scrollyOld = 0;

+ 2
- 2
src/pages/HogoodCoffee/index.html View File

@@ -84,11 +84,11 @@
84 84
                             powder,</div>
85 85
                         <div class="flexBox">
86 86
                             <div class="p3">the Company currently has an annual production capacity of</div>
87
-                            <div class="p4">13,000 tons</div>
87
+                            <div class="p4"><span>13,000 tons</span> </div>
88 88
                         </div>
89 89
                         <div class="flexBox">
90 90
                             <div class="p3">by 2025 capacity expansion will be completed</div>
91
-                            <div class="p4">10,000 tons</div>
91
+                            <div class="p4"><span>10,000 tons</span> </div>
92 92
                         </div>
93 93
                     </div>
94 94
                     <img src="./static/images/hgkf/cont.png" alt="">

+ 48
- 12
src/pages/HogoodCoffee/index.less View File

@@ -111,13 +111,13 @@
111 111
                 width: 380px;
112 112
             }
113 113
             .p4{
114
-                font-size: 46px;
114
+                font-size: 50px;
115 115
                 font-weight: bold;
116 116
                 text-align: center;
117 117
                 font-family: "思源";
118 118
                 padding-right: 25px;
119 119
                 span{
120
-                    font-family: DIN, DIN;
120
+                    font-family: "DINBOLD";
121 121
                 }
122 122
             }
123 123
             .p5{
@@ -493,20 +493,56 @@ p{
493 493
 
494 494
 
495 495
 @media screen and (min-width: 1300px) and (max-width: 1600px) {
496
-    .banner {
497
-        // .slideCon {
498
-        //     padding: 180px 10px 0px;
499
-        //     box-sizing: border-box;
500
-        // }
496
+    .hg-header{
497
+        .headerPC{
498
+            padding: 0 50px;
499
+        }
500
+        .logo{
501
+            transform: scale(0.5);
502
+        }
503
+        .menu {
504
+            &>div {
505
+                &>a {
506
+                    font-size: 16px;
507
+                }
508
+            }
509
+        }
510
+    }
511
+    .main{
512
+        .chart{
513
+            background-size: 100% auto;
514
+            .tbGif{
515
+                width: 80%;
516
+                height: auto;
517
+            }
518
+        }
501 519
     }
502 520
 }
503 521
 
504 522
 @media screen and (min-width: 801px) and (max-width: 1300px) {
505
-    .banner {
506
-        // .slideCon {
507
-        //     padding: 120px 10px 0px;
508
-        //     box-sizing: border-box;
509
-        // }
523
+    .hg-header{
524
+        .headerPC{
525
+            padding: 0 50px;
526
+        }
527
+        .logo{
528
+            transform: scale(0.5);
529
+        }
530
+        .menu {
531
+            &>div {
532
+                &>a {
533
+                    font-size: 16px;
534
+                }
535
+            }
536
+        }
537
+    }
538
+    .main{
539
+        .chart{
540
+            background-size: 100% auto;
541
+            .tbGif{
542
+                width: 80%;
543
+                height: auto;
544
+            }
545
+        }
510 546
     }
511 547
 
512 548
 }

Loading…
Cancel
Save