瀏覽代碼

mrna 新增loading&nicescroll

Sherry 1 年之前
父節點
當前提交
20fe1b492f

+ 100
- 6
src/fe/mrna/css/all.css 查看文件

@@ -14107,6 +14107,97 @@ p {
14107 14107
     height: 1.5em;
14108 14108
   }
14109 14109
 }
14110
+.loading {
14111
+  position: fixed;
14112
+  top: 0;
14113
+  left: 0;
14114
+  width: 100%;
14115
+  height: 100%;
14116
+  display: flex;
14117
+  justify-content: center;
14118
+  align-items: center;
14119
+  z-index: 2999;
14120
+  background: rgba(0, 112, 160, 0.9);
14121
+}
14122
+.loading__box {
14123
+  position: absolute;
14124
+  top: 50%;
14125
+  left: 50%;
14126
+  transform: translate(-50%, -50%);
14127
+  width: 100%;
14128
+  height: 100%;
14129
+  display: flex;
14130
+  justify-content: center;
14131
+  align-items: center;
14132
+  z-index: 1;
14133
+}
14134
+.loading__ani {
14135
+  position: relative;
14136
+  width: 8.125em;
14137
+  height: 8.125em;
14138
+  border-radius: 100%;
14139
+  border: 2px solid transparent;
14140
+  border-color: transparent rgba(255, 255, 255, 0.5) transparent rgba(255, 255, 255, 0.5);
14141
+  animation: rotate-loading 1.5s linear 0s infinite normal;
14142
+  transform-origin: 50% 50%;
14143
+  -webkit-transition: all 0.5s ease-in-out;
14144
+  -moz-transition: all 0.5s ease-in-out;
14145
+  -ms-transition: all 0.5s ease-in-out;
14146
+  -o-transition: all 0.5s ease-in-out;
14147
+  transition: all 0.5s ease-in-out;
14148
+}
14149
+.loading__text {
14150
+  color: rgba(255, 255, 255, 0.8);
14151
+  font-size: 1.125em;
14152
+  font-weight: 400;
14153
+  line-height: 1;
14154
+  opacity: 1;
14155
+  position: absolute;
14156
+  top: 50%;
14157
+  left: 50%;
14158
+  transform: translate(-50%, -50%);
14159
+  text-align: center;
14160
+  text-transform: uppercase;
14161
+}
14162
+@keyframes picIn {
14163
+  0% {
14164
+    transform: scale(0.7);
14165
+  }
14166
+  100% {
14167
+    transform: scale(1);
14168
+  }
14169
+}
14170
+@keyframes rotate-loading {
14171
+  0% {
14172
+    transform: rotate(0deg);
14173
+    -ms-transform: rotate(0deg);
14174
+    -webkit-transform: rotate(0deg);
14175
+    -o-transform: rotate(0deg);
14176
+    -moz-transform: rotate(0deg);
14177
+  }
14178
+  100% {
14179
+    transform: rotate(360deg);
14180
+    -ms-transform: rotate(360deg);
14181
+    -webkit-transform: rotate(360deg);
14182
+    -o-transform: rotate(360deg);
14183
+    -moz-transform: rotate(360deg);
14184
+  }
14185
+}
14186
+@keyframes loading-text-opacity {
14187
+  0% {
14188
+    opacity: 0;
14189
+  }
14190
+  20% {
14191
+    opacity: 0;
14192
+  }
14193
+  50% {
14194
+    opacity: 1;
14195
+  }
14196
+  100% {
14197
+    opacity: 0;
14198
+  }
14199
+}
14200
+
14110 14201
 .expert {
14111 14202
   position: relative;
14112 14203
 }
@@ -14230,7 +14321,7 @@ p {
14230 14321
   transform: translateY(-50%);
14231 14322
   width: 7.6em;
14232 14323
   height: 0.05em;
14233
-  background-color: rgba(134, 134, 134, 0.5);
14324
+  background-color: rgba(134, 134, 134, 0.3);
14234 14325
 }
14235 14326
 .qa__keypoint__item:nth-child(2) .qa__keypoint__pic__line-left {
14236 14327
   left: -7.6em;
@@ -14250,11 +14341,11 @@ p {
14250 14341
 .qa__keypoint__pic__frame {
14251 14342
   position: absolute;
14252 14343
   left: 50%;
14253
-  top: 49%;
14344
+  top: 50%;
14254 14345
   transform: translate(-50%, -50%);
14255
-  width: 9em;
14256
-  height: 9em;
14257
-  border: 0.05em solid rgba(134, 134, 134, 0.5);
14346
+  width: 8.8em;
14347
+  height: 8.8em;
14348
+  border: 0.05em solid rgba(134, 134, 134, 0.3);
14258 14349
   border-radius: 50%;
14259 14350
 }
14260 14351
 .qa__keypoint__exp p {
@@ -14339,8 +14430,9 @@ p {
14339 14430
     top: auto;
14340 14431
     left: 50%;
14341 14432
     transform: translateX(-50%);
14342
-    width: 0.05em;
14433
+    width: 0.1em;
14343 14434
     height: 3em;
14435
+    background-color: rgba(134, 134, 134, 0.5);
14344 14436
   }
14345 14437
   .qa__keypoint__item:nth-child(2) .qa__keypoint__pic__line-left {
14346 14438
     top: -3em;
@@ -14357,6 +14449,7 @@ p {
14357 14449
   .qa__keypoint__pic__frame {
14358 14450
     width: 15.2em;
14359 14451
     height: 15.2em;
14452
+    border: 0.05em solid rgba(134, 134, 134, 0.5);
14360 14453
   }
14361 14454
   .qa__keypoint__exp {
14362 14455
     flex: 1;
@@ -14563,6 +14656,7 @@ p {
14563 14656
   }
14564 14657
   .history__timeline__desc p {
14565 14658
     font-size: 2.1em;
14659
+    font-weight: 400;
14566 14660
   }
14567 14661
   .history__timeline .swiper-button-prev, .history__timeline .swiper-container-rtl .swiper-button-next {
14568 14662
     left: 1em;

+ 1
- 1
src/fe/mrna/css/all.css.map
文件差異過大導致無法顯示
查看文件


+ 1
- 0
src/fe/mrna/css/all.scss 查看文件

@@ -24,6 +24,7 @@
24 24
 @import "component/modal";
25 25
 @import "component/video";
26 26
 @import "component/swiper";
27
+@import "component/loading";
27 28
 
28 29
 // 區塊section
29 30
 @import "section/expert";

+ 106
- 0
src/fe/mrna/css/component/_loading.scss 查看文件

@@ -0,0 +1,106 @@
1
+.loading {
2
+    // opacity: 0;
3
+    // visibility: hidden;
4
+    position: fixed;
5
+    top: 0;
6
+    left: 0;
7
+    width: 100%;
8
+    height: 100%;
9
+    display: flex;
10
+    justify-content: center;
11
+    align-items: center;
12
+    z-index: 2999;
13
+    background: rgba($blue-d, 0.9);
14
+    &__box {
15
+        position: absolute;
16
+        top: 50%;
17
+        left: 50%;
18
+        transform: translate(-50%,-50%);
19
+        width: 100%;
20
+        height: 100%;
21
+        display: flex;
22
+        justify-content: center;
23
+        align-items: center;
24
+        z-index: 1;
25
+    }
26
+
27
+    &__ani {
28
+        position: relative;
29
+        width: em(130);
30
+        height: em(130);
31
+        border-radius: 100%;
32
+        border: 2px solid transparent;
33
+        border-color: transparent rgba($white, 0.5) transparent rgba($white, 0.5);
34
+        animation: rotate-loading 1.5s linear 0s infinite normal;
35
+        transform-origin: 50% 50%;
36
+
37
+        -webkit-transition: all 0.5s ease-in-out;
38
+        -moz-transition: all 0.5s ease-in-out;
39
+        -ms-transition: all 0.5s ease-in-out;
40
+        -o-transition: all 0.5s ease-in-out;
41
+        transition: all 0.5s ease-in-out;
42
+    }
43
+
44
+    &__text {
45
+        // -moz-animation: loading-text-opacity 2s linear 0s infinite normal;
46
+        // -o-animation: loading-text-opacity 2s linear 0s infinite normal;
47
+        // -webkit-animation: loading-text-opacity 2s linear 0s infinite normal;
48
+        // animation: loading-text-opacity 2s linear 0s infinite normal;
49
+        color: rgba($white, 0.8);
50
+        font-size: em(18);
51
+        font-weight: 400;
52
+        line-height: 1;
53
+        opacity: 1;
54
+        position: absolute;
55
+        top: 50%;
56
+        left: 50%;
57
+        transform: translate(-50%,-50%);
58
+        text-align: center;
59
+        text-transform: uppercase;
60
+    }
61
+
62
+    @keyframes picIn {
63
+        0% {
64
+            transform: scale(0.7);
65
+        }
66
+        100% {
67
+            transform: scale(1);
68
+        }
69
+    }
70
+
71
+    @keyframes rotate-loading {
72
+        0% {
73
+            transform: rotate(0deg);
74
+            -ms-transform: rotate(0deg);
75
+            -webkit-transform: rotate(0deg);
76
+            -o-transform: rotate(0deg);
77
+            -moz-transform: rotate(0deg);
78
+        }
79
+
80
+        100% {
81
+            transform: rotate(360deg);
82
+            -ms-transform: rotate(360deg);
83
+            -webkit-transform: rotate(360deg);
84
+            -o-transform: rotate(360deg);
85
+            -moz-transform: rotate(360deg);
86
+        }
87
+    }
88
+
89
+    @keyframes loading-text-opacity {
90
+        0% {
91
+            opacity: 0
92
+        }
93
+
94
+        20% {
95
+            opacity: 0
96
+        }
97
+
98
+        50% {
99
+            opacity: 1
100
+        }
101
+
102
+        100% {
103
+            opacity: 0
104
+        }
105
+    }
106
+}

+ 1
- 0
src/fe/mrna/css/section/_history.scss 查看文件

@@ -200,6 +200,7 @@
200 200
             &__desc {
201 201
                 p {
202 202
                     font-size: 2.1em;
203
+                    font-weight: 400;
203 204
                 }
204 205
             }
205 206
             .swiper-button-prev, .swiper-container-rtl .swiper-button-next {

+ 8
- 6
src/fe/mrna/css/section/_qa.scss 查看文件

@@ -44,7 +44,7 @@
44 44
                     transform: translateY(-50%);
45 45
                     width: 7.6em;
46 46
                     height: 0.05em;
47
-                    background-color: rgba($gray, 0.5);
47
+                    background-color: rgba($gray, 0.3);
48 48
                     &-left {
49 49
                         left: -7.6em;
50 50
                     }
@@ -65,11 +65,11 @@
65 65
             &__frame {
66 66
                 position: absolute;
67 67
                 left: 50%;
68
-                top: 49%;
68
+                top: 50%;
69 69
                 transform: translate(-50%, -50%);
70
-                width: 9em;
71
-                height: 9em;
72
-                border: 0.05em solid rgba($gray, 0.5);
70
+                width: 8.8em;
71
+                height: 8.8em;
72
+                border: 0.05em solid rgba($gray, 0.3);
73 73
                 border-radius: 50%;
74 74
             }
75 75
         }
@@ -161,8 +161,9 @@
161 161
                         top: auto;
162 162
                         left: 50%;
163 163
                         transform: translateX(-50%);
164
-                        width: 0.05em;
164
+                        width: 0.1em;
165 165
                         height: 3em;
166
+                        background-color: rgba($gray, 0.5);
166 167
                         &-left {
167 168
                             top: -3em;
168 169
                         }
@@ -180,6 +181,7 @@
180 181
                 &__frame {
181 182
                     width: 15.2em;
182 183
                     height: 15.2em;
184
+                    border: 0.05em solid rgba($gray, 0.5);
183 185
                 }
184 186
             }
185 187
             &__exp {

+ 12
- 1
src/fe/mrna/index.html 查看文件

@@ -51,6 +51,17 @@
51 51
 
52 52
 <body>
53 53
 
54
+  <div class="wapper-loading">
55
+    <!-- Loading Start -->
56
+    <div class="loading">
57
+      <div class="loading__box">
58
+        <div class="loading__ani"></div>
59
+        <div class="loading__text">Loading</div>
60
+      </div>
61
+    </div>
62
+    <!-- Loading End -->
63
+  </div>
64
+
54 65
   <div class="wrapper">
55 66
     <header class="header">
56 67
       <div class="header__hamburger">
@@ -354,7 +365,7 @@
354 365
             <h2>mRNA疫苗常見問題</h2>
355 366
           </div>
356 367
         </div>
357
-        <p>
368
+        <p class="qa__desc">
358 369
           2023年5月5日世界衛生組織宣布結束COVID-19作為國際關注<br class="mb-show">的突發公共衛生事件<span>〔16〕</span> ,然而隨著病毒持續變異,<br class="mb-show">COVID-19尚未消失……
359 370
         </p>
360 371
         <div class="qa__keypoint">

+ 77
- 72
src/fe/mrna/js/main.js 查看文件

@@ -162,60 +162,66 @@ main = function () {
162 162
 		swiperHandler_history();
163 163
 
164 164
 		setTimeout(() => {
165
-			gsap.to(".wrapper", { duration: 0.3, autoAlpha: 1 });
166 165
 
167 166
 			detectScrollSection();
168 167
 
168
+			//元素動態
169
+			elementAni();
170
+
169 171
 			$(window).scroll(function(){
170 172
 				detectScrollSection();
171 173
 				ScrollTrigger.update();
172 174
 			})
173 175
 
176
+			if(!isMobile) {
177
+				$(".qa__box__scroll").niceScroll({
178
+					cursorcolor: "#2ba4da", // 滾動條的顏色
179
+					cursorwidth: "0.6em", // 滾動條寬度
180
+					cursorborder: "1px solid #fff", // 滾動條邊框
181
+					cursorborderradius: "5px", // 滾動條圓角
182
+					touchbehavior: false, // 是否啟用拖曳行為
183
+					autohidemode: false, // 不隱藏卷軸
184
+					background: "", // 軌道背景色
185
+					cursorminheight: 32, // 滾動條最小高度
186
+					railpadding: { top: 0, right: 0, left: 0, bottom: 0 }, // 軌道內間距
187
+					railalign: "center", // 對其垂直軌道
188
+					railvalign: "center", // 對其水平軌道
189
+					cursordragontouch: false, // 使用觸屏模式來實現拖曳
190
+					grabcursorenabled: false,
191
+				});
192
+			}else {
193
+				$(".qa__box__scroll").niceScroll({
194
+					cursorcolor: "#2ba4da", // 滾動條的顏色
195
+					cursorwidth: "0.7em", // 滾動條寬度
196
+					cursorborder: "1px solid #fff", // 滾動條邊框
197
+					cursorborderradius: "5px", // 滾動條圓角
198
+					touchbehavior: false, // 是否啟用拖曳行為
199
+					autohidemode: false, // 不隱藏卷軸
200
+					background: "", // 軌道背景色
201
+					cursorminheight: 32, // 滾動條最小高度
202
+					railpadding: { top: 0, right: 0, left: 0, bottom: 0 }, // 軌道內間距
203
+					railalign: "center", // 對其垂直軌道
204
+					railvalign: "center", // 對其水平軌道
205
+					cursordragontouch: false, // 使用觸屏模式來實現拖曳
206
+					grabcursorenabled: false,
207
+				});
208
+				
209
+			}
210
+
174 211
 			setTimeout(()=>{
212
+				gsap.to(".wapper-loading", { duration: 0.3, autoAlpha: 0, onComplete: function(){
213
+					$(".wapper-loading").remove();
214
+				} });
215
+				
216
+				$(".qa__box__scroll").getNiceScroll().resize();
217
+				gsap.to(".wrapper", { duration: 0.3, autoAlpha: 1 });
175 218
 
176
-				if(!isMobile) {
177
-					$(".qa__box__scroll").niceScroll({
178
-						cursorcolor: "#2ba4da", // 滾動條的顏色
179
-						cursorwidth: "0.6em", // 滾動條寬度
180
-						cursorborder: "1px solid #fff", // 滾動條邊框
181
-						cursorborderradius: "5px", // 滾動條圓角
182
-						touchbehavior: false, // 是否啟用拖曳行為
183
-						autohidemode: false, // 不隱藏卷軸
184
-						background: "", // 軌道背景色
185
-						cursorminheight: 32, // 滾動條最小高度
186
-						railpadding: { top: 0, right: 0, left: 0, bottom: 0 }, // 軌道內間距
187
-						railalign: "center", // 對其垂直軌道
188
-						railvalign: "center", // 對其水平軌道
189
-						cursordragontouch: false, // 使用觸屏模式來實現拖曳
190
-						grabcursorenabled: false,
191
-					});
192
-				}else {
193
-					$(".qa__box__scroll").niceScroll({
194
-						cursorcolor: "#2ba4da", // 滾動條的顏色
195
-						cursorwidth: "0.7em", // 滾動條寬度
196
-						cursorborder: "1px solid #fff", // 滾動條邊框
197
-						cursorborderradius: "5px", // 滾動條圓角
198
-						touchbehavior: false, // 是否啟用拖曳行為
199
-						autohidemode: false, // 不隱藏卷軸
200
-						background: "", // 軌道背景色
201
-						cursorminheight: 32, // 滾動條最小高度
202
-						railpadding: { top: 0, right: 0, left: 0, bottom: 0 }, // 軌道內間距
203
-						railalign: "center", // 對其垂直軌道
204
-						railvalign: "center", // 對其水平軌道
205
-						cursordragontouch: false, // 使用觸屏模式來實現拖曳
206
-						grabcursorenabled: false,
207
-					});
208
-				}
219
+				//開頭動態
220
+				startAni();
209 221
 
210
-			}, 1000);
222
+			}, 500);
211 223
 	
212
-
213
-			//開頭動態
214
-			startAni();
215
-
216
-			//元素動態
217
-			elementAni();
218
-		}, 1000);
224
+		}, 500);
219 225
 	}
220 226
 
221 227
 	// 桌機調整視窗大小
@@ -575,7 +581,9 @@ main = function () {
575 581
 		gsap.set(".history .container", { y: 50, autoAlpha: 0 });
576 582
 		gsap.set(".research .container", { y: 50, autoAlpha: 0 });
577 583
 		gsap.set(".research .research__item", { autoAlpha: 0 });
578
-		gsap.set(".qa .container", { y: 50, autoAlpha: 0 });
584
+		gsap.set(".qa .copywriting", { y: 50, autoAlpha: 0 });
585
+		gsap.set(".qa .qa__desc", { y: 50, autoAlpha: 0 });
586
+		gsap.set(".qa .qa__keypoint h3", { y: 50, autoAlpha: 0 });
579 587
 		gsap.set(".moreref .container", { y: 50, autoAlpha: 0 });
580 588
 		gsap.set(".qa .qa__keypoint__item:nth-child(1)", { x: 100, autoAlpha: 0 });
581 589
 		gsap.set(".qa .qa__keypoint__item:nth-child(3)", { x: -100, autoAlpha: 0 });
@@ -667,7 +675,7 @@ main = function () {
667 675
 			autoAlpha: 1,
668 676
 		});
669 677
 
670
-		gsap.to(".qa .container", {
678
+		gsap.to(".qa .copywriting", {
671 679
 			scrollTrigger: {
672 680
 				trigger: ".qa",
673 681
 				start: "top center",
@@ -676,7 +684,31 @@ main = function () {
676 684
 			},
677 685
 			duration: 0.3,
678 686
 			autoAlpha: 1,
679
-			y: 0
687
+			y:0
688
+		});
689
+
690
+		gsap.to(".qa .qa__desc", {
691
+			scrollTrigger: {
692
+				trigger: ".qa .qa__desc",
693
+				start: "top center",
694
+				end: "+=" + ($(".qa").height() / 3),
695
+				scrub: 1,
696
+			},
697
+			duration: 0.3,
698
+			autoAlpha: 1,
699
+			y:0
700
+		});
701
+
702
+		gsap.to(".qa .qa__keypoint h3", {
703
+			scrollTrigger: {
704
+				trigger: ".qa .qa__desc",
705
+				start: "top center",
706
+				end: "+=" + ($(".qa").height() / 3),
707
+				scrub: 1,
708
+			},
709
+			duration: 0.3,
710
+			autoAlpha: 1,
711
+			y:0
680 712
 		});
681 713
 
682 714
 		gsap.to(".qa .qa__keypoint__item:nth-child(1)", {
@@ -714,33 +746,6 @@ main = function () {
714 746
 			autoAlpha: 1,
715 747
 			y: 0
716 748
 		});
717
-
718
-		// gsap.to(".game__head", {
719
-		// 	scrollTrigger: {
720
-		// 		trigger: ".game",
721
-		// 		start: "top center",
722
-		// 		end: "+=" + $(".game__head").height(),
723
-		// 		scrub: 1,
724
-		// 	},
725
-		// 	duration: 0.3,
726
-		// 	scale: 1,
727
-		// 	autoAlpha: 1,
728
-		// 	y: 0,
729
-		// });
730
-
731
-		// gsap.to(".game__place", {
732
-		// 	scrollTrigger: {
733
-		// 		trigger: ".game",
734
-		// 		start: "top center",
735
-		// 		end: "+=" + $(".game__head").height(),
736
-		// 		scrub: 1,
737
-		// 	},
738
-		// 	duration: 0.3,
739
-		// 	scale: 1,
740
-		// 	autoAlpha: 1,
741
-		// 	y: 0,
742
-		// 	delay: 0.2,
743
-		// });
744 749
 	}
745 750
 
746 751
 	function scrollToSection() {