File tree Expand file tree Collapse file tree 3 files changed +43
-4
lines changed Expand file tree Collapse file tree 3 files changed +43
-4
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,12 @@ <h1 id="title">这就是VV</h1>
67
67
</ svg >
68
68
</ a >
69
69
</ footer >
70
+
71
+ < footer id ="backToTop " class ="back-to-top " title ="返回顶部 ">
72
+ < svg xmlns ="http://www.w3.org/2000/svg " width ="32 " height ="32 " viewBox ="0 0 32 32 " fill ="none " stroke ="currentColor " stroke-width ="2 ">
73
+ < path d ="M17 15l-5-5-5 5 "/>
74
+ </ svg >
75
+ </ footer >
70
76
71
77
< script src ="db_search.js "> </ script >
72
78
< script src ="script.js "> </ script >
Original file line number Diff line number Diff line change @@ -706,4 +706,20 @@ function handleCardClick(result) {
706
706
break
707
707
}
708
708
}
709
- }
709
+ }
710
+ // backToTop
711
+ var button = document . getElementById ( 'backToTop' ) ;
712
+ button . style . display = 'none' ;
713
+ window . addEventListener ( 'scroll' , function ( ) {
714
+ if ( window . pageYOffset > 200 ) {
715
+ button . style . display = 'block' ;
716
+ } else {
717
+ button . style . display = 'none' ;
718
+ }
719
+ } ) ;
720
+ button . addEventListener ( 'click' , function ( ) {
721
+ window . scrollTo ( {
722
+ top : 0 ,
723
+ behavior : 'smooth'
724
+ } ) ;
725
+ } ) ;
Original file line number Diff line number Diff line change @@ -311,8 +311,14 @@ input:focus {
311
311
}
312
312
313
313
.site-footer {
314
- text-align : center;
315
- padding : 2rem 0 ;
314
+ position : fixed;
315
+ top : 0.5rem ;
316
+ right : 0.5rem ;
317
+ padding : 1rem ;
318
+ z-index : 1000 ;
319
+ text-align : right;
320
+ backdrop-filter : blur (20px );
321
+ -webkit-mask : radial-gradient (closest-side circle, # 000 40% , transparent 100% );
316
322
}
317
323
318
324
.github-link {
@@ -325,6 +331,17 @@ input:focus {
325
331
opacity : 1 ;
326
332
}
327
333
334
+ .back-to-top {
335
+ position : fixed;
336
+ bottom : 0.5rem ;
337
+ right : 0.5rem ;
338
+ padding : 1rem ;
339
+ z-index : 1000 ;
340
+ text-align : right;
341
+ backdrop-filter : blur (20px );
342
+ -webkit-mask : radial-gradient (closest-side circle, # 000 40% , transparent 100% );
343
+ }
344
+
328
345
@media (max-width : 640px ) {
329
346
.main-content {
330
347
padding : 0 1rem ;
@@ -780,4 +797,4 @@ button {
780
797
.error-message : active {
781
798
background-color : var (--gray-100 );
782
799
}
783
- }
800
+ }
You can’t perform that action at this time.
0 commit comments