Ver código fonte

mrna 新增loading&nicescroll

Sherry 1 ano atrás
pai
commit
20fe1b492f

+ 100
- 6
src/fe/mrna/css/all.css Ver arquivo

14107
     height: 1.5em;
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
 .expert {
14201
 .expert {
14111
   position: relative;
14202
   position: relative;
14112
 }
14203
 }
14230
   transform: translateY(-50%);
14321
   transform: translateY(-50%);
14231
   width: 7.6em;
14322
   width: 7.6em;
14232
   height: 0.05em;
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
 .qa__keypoint__item:nth-child(2) .qa__keypoint__pic__line-left {
14326
 .qa__keypoint__item:nth-child(2) .qa__keypoint__pic__line-left {
14236
   left: -7.6em;
14327
   left: -7.6em;
14250
 .qa__keypoint__pic__frame {
14341
 .qa__keypoint__pic__frame {
14251
   position: absolute;
14342
   position: absolute;
14252
   left: 50%;
14343
   left: 50%;
14253
-  top: 49%;
14344
+  top: 50%;
14254
   transform: translate(-50%, -50%);
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
   border-radius: 50%;
14349
   border-radius: 50%;
14259
 }
14350
 }
14260
 .qa__keypoint__exp p {
14351
 .qa__keypoint__exp p {
14339
     top: auto;
14430
     top: auto;
14340
     left: 50%;
14431
     left: 50%;
14341
     transform: translateX(-50%);
14432
     transform: translateX(-50%);
14342
-    width: 0.05em;
14433
+    width: 0.1em;
14343
     height: 3em;
14434
     height: 3em;
14435
+    background-color: rgba(134, 134, 134, 0.5);
14344
   }
14436
   }
14345
   .qa__keypoint__item:nth-child(2) .qa__keypoint__pic__line-left {
14437
   .qa__keypoint__item:nth-child(2) .qa__keypoint__pic__line-left {
14346
     top: -3em;
14438
     top: -3em;
14357
   .qa__keypoint__pic__frame {
14449
   .qa__keypoint__pic__frame {
14358
     width: 15.2em;
14450
     width: 15.2em;
14359
     height: 15.2em;
14451
     height: 15.2em;
14452
+    border: 0.05em solid rgba(134, 134, 134, 0.5);
14360
   }
14453
   }
14361
   .qa__keypoint__exp {
14454
   .qa__keypoint__exp {
14362
     flex: 1;
14455
     flex: 1;
14563
   }
14656
   }
14564
   .history__timeline__desc p {
14657
   .history__timeline__desc p {
14565
     font-size: 2.1em;
14658
     font-size: 2.1em;
14659
+    font-weight: 400;
14566
   }
14660
   }
14567
   .history__timeline .swiper-button-prev, .history__timeline .swiper-container-rtl .swiper-button-next {
14661
   .history__timeline .swiper-button-prev, .history__timeline .swiper-container-rtl .swiper-button-next {
14568
     left: 1em;
14662
     left: 1em;

+ 1
- 1
src/fe/mrna/css/all.css.map
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


+ 1
- 0
src/fe/mrna/css/all.scss Ver arquivo

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

+ 106
- 0
src/fe/mrna/css/component/_loading.scss Ver arquivo

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 Ver arquivo

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

+ 8
- 6
src/fe/mrna/css/section/_qa.scss Ver arquivo

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

+ 12
- 1
src/fe/mrna/index.html Ver arquivo

51
 
51
 
52
 <body>
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
   <div class="wrapper">
65
   <div class="wrapper">
55
     <header class="header">
66
     <header class="header">
56
       <div class="header__hamburger">
67
       <div class="header__hamburger">
354
             <h2>mRNA疫苗常見問題</h2>
365
             <h2>mRNA疫苗常見問題</h2>
355
           </div>
366
           </div>
356
         </div>
367
         </div>
357
-        <p>
368
+        <p class="qa__desc">
358
           2023年5月5日世界衛生組織宣布結束COVID-19作為國際關注<br class="mb-show">的突發公共衛生事件<span>〔16〕</span> ,然而隨著病毒持續變異,<br class="mb-show">COVID-19尚未消失……
369
           2023年5月5日世界衛生組織宣布結束COVID-19作為國際關注<br class="mb-show">的突發公共衛生事件<span>〔16〕</span> ,然而隨著病毒持續變異,<br class="mb-show">COVID-19尚未消失……
359
         </p>
370
         </p>
360
         <div class="qa__keypoint">
371
         <div class="qa__keypoint">

+ 77
- 72
src/fe/mrna/js/main.js Ver arquivo

162
 		swiperHandler_history();
162
 		swiperHandler_history();
163
 
163
 
164
 		setTimeout(() => {
164
 		setTimeout(() => {
165
-			gsap.to(".wrapper", { duration: 0.3, autoAlpha: 1 });
166
 
165
 
167
 			detectScrollSection();
166
 			detectScrollSection();
168
 
167
 
168
+			//元素動態
169
+			elementAni();
170
+
169
 			$(window).scroll(function(){
171
 			$(window).scroll(function(){
170
 				detectScrollSection();
172
 				detectScrollSection();
171
 				ScrollTrigger.update();
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
 			setTimeout(()=>{
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
 		gsap.set(".history .container", { y: 50, autoAlpha: 0 });
581
 		gsap.set(".history .container", { y: 50, autoAlpha: 0 });
576
 		gsap.set(".research .container", { y: 50, autoAlpha: 0 });
582
 		gsap.set(".research .container", { y: 50, autoAlpha: 0 });
577
 		gsap.set(".research .research__item", { autoAlpha: 0 });
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
 		gsap.set(".moreref .container", { y: 50, autoAlpha: 0 });
587
 		gsap.set(".moreref .container", { y: 50, autoAlpha: 0 });
580
 		gsap.set(".qa .qa__keypoint__item:nth-child(1)", { x: 100, autoAlpha: 0 });
588
 		gsap.set(".qa .qa__keypoint__item:nth-child(1)", { x: 100, autoAlpha: 0 });
581
 		gsap.set(".qa .qa__keypoint__item:nth-child(3)", { x: -100, autoAlpha: 0 });
589
 		gsap.set(".qa .qa__keypoint__item:nth-child(3)", { x: -100, autoAlpha: 0 });
667
 			autoAlpha: 1,
675
 			autoAlpha: 1,
668
 		});
676
 		});
669
 
677
 
670
-		gsap.to(".qa .container", {
678
+		gsap.to(".qa .copywriting", {
671
 			scrollTrigger: {
679
 			scrollTrigger: {
672
 				trigger: ".qa",
680
 				trigger: ".qa",
673
 				start: "top center",
681
 				start: "top center",
676
 			},
684
 			},
677
 			duration: 0.3,
685
 			duration: 0.3,
678
 			autoAlpha: 1,
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
 		gsap.to(".qa .qa__keypoint__item:nth-child(1)", {
714
 		gsap.to(".qa .qa__keypoint__item:nth-child(1)", {
714
 			autoAlpha: 1,
746
 			autoAlpha: 1,
715
 			y: 0
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
 	function scrollToSection() {
751
 	function scrollToSection() {