File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change 16
16
{{ end }}
17
17
</ main >
18
18
19
+ < button id ="scrollToTop " class ="scroll-to-top "> < div class ="topArrow ">
20
+ ↑
21
+ </ div > </ button >
22
+
19
23
{{ block "footer.html" . }}
20
24
{{ partialCached "footer.html" . }}
21
25
{{ end }}
22
26
23
27
{{ block "scripts" . }}
24
28
{{ partial "scripts" . }}
29
+
30
+
31
+ < script >
32
+ document . addEventListener ( "DOMContentLoaded" , ( ) => {
33
+ const scrollToTopButton = document . getElementById ( "scrollToTop" ) ;
34
+
35
+ window . addEventListener ( "scroll" , ( ) => {
36
+ if ( window . scrollY > 300 ) {
37
+ scrollToTopButton . style . display = "block" ;
38
+ } else {
39
+ scrollToTopButton . style . display = "none" ;
40
+ }
41
+ } ) ;
42
+
43
+ scrollToTopButton . addEventListener ( "click" , ( ) => {
44
+ window . scrollTo ( {
45
+ top : 0 ,
46
+ behavior : "smooth"
47
+ } ) ;
48
+ } ) ;
49
+ } ) ;
50
+ </ script >
51
+
52
+ < style >
53
+
54
+ </ style >
55
+
25
56
{{ end }}
26
57
27
58
</ body >
Original file line number Diff line number Diff line change @@ -301,6 +301,33 @@ body>header nav a.active {
301
301
display : none
302
302
}
303
303
304
+ .scroll-to-top {
305
+ display : none;
306
+ position : fixed;
307
+ bottom : 20px ;
308
+ right : 20px ;
309
+ padding : 10px 15px ;
310
+ background-color : # 007BFF ;
311
+ color : black;
312
+ border : none;
313
+ height : 60px ;
314
+ width : 60px ;
315
+ border-radius : 50% ;
316
+ cursor : pointer;
317
+ z-index : 1000 ;
318
+ box-shadow : 0 2px 5px rgba (0 , 0 , 0 , 0.2 );
319
+ }
320
+
321
+ .scroll-to-top : hover {
322
+ background-color : # 0056b3 ;
323
+ }
324
+ .topArrow {
325
+ font-size : 40px ;
326
+ position : relative;
327
+ bottom : 55px ;
328
+ color : white;
329
+ }
330
+
304
331
@media (max-width : 71.24em ) {
305
332
body > header {
306
333
flex-wrap : wrap
You can’t perform that action at this time.
0 commit comments