File tree Expand file tree Collapse file tree 3 files changed +98
-1
lines changed Expand file tree Collapse file tree 3 files changed +98
-1
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,7 @@ <h2>Projects</h2>
245
245
</ li >
246
246
</ ul >
247
247
</ div >
248
+
248
249
249
250
250
251
</ div > <!-- /resume-sections -->
@@ -255,6 +256,8 @@ <h2>Projects</h2>
255
256
</ div >
256
257
</ div > <!-- /preview-section -->
257
258
</ div > <!-- /main-container -->
259
+ <!-- back-to-top button -->
260
+ < button class ="back-to-top " id ="backToTop " title ="Back to Top "> </ button >
258
261
259
262
< footer style ="margin-top: 2rem; padding: 1rem 0; text-align: center; font-size: 0.9rem; " class ="footer ">
260
263
< div class ="foot ">
@@ -267,6 +270,7 @@ <h2>Projects</h2>
267
270
</ footer >
268
271
269
272
273
+
270
274
< script src ="script.js " defer > </ script >
271
275
</ body >
272
276
</ html >
Original file line number Diff line number Diff line change @@ -343,6 +343,36 @@ toggle.addEventListener('click', () => {
343
343
localStorage . setItem ( 'theme' , 'light' ) ;
344
344
}
345
345
} ) ;
346
+ // back to top section
347
+ const backToTopButton = document . getElementById ( 'backToTop' ) ;
348
+
349
+ // Show/hide button based on scroll position
350
+ window . addEventListener ( 'scroll' , function ( ) {
351
+ if ( window . pageYOffset > 300 ) {
352
+ backToTopButton . classList . add ( 'show' ) ;
353
+ } else {
354
+ backToTopButton . classList . remove ( 'show' ) ;
355
+ }
356
+ } ) ;
357
+
358
+ // Smooth scroll to top when button is clicked
359
+ backToTopButton . addEventListener ( 'click' , function ( ) {
360
+ window . scrollTo ( {
361
+ top : 0 ,
362
+ behavior : 'smooth'
363
+ } ) ;
364
+ } ) ;
365
+
366
+ // Optional: Add keyboard support (Enter or Space key)
367
+ backToTopButton . addEventListener ( 'keydown' , function ( e ) {
368
+ if ( e . key === 'Enter' || e . key === ' ' ) {
369
+ e . preventDefault ( ) ;
370
+ window . scrollTo ( {
371
+ top : 0 ,
372
+ behavior : 'smooth'
373
+ } ) ;
374
+ }
375
+ } ) ;
346
376
// --- Draggable Resume Section Reordering ---
347
377
document . addEventListener ( "DOMContentLoaded" , ( ) => {
348
378
const container = document . getElementById ( "resume-sections" ) ;
Original file line number Diff line number Diff line change @@ -490,7 +490,70 @@ ul li ul {
490
490
padding : 10px ;
491
491
}
492
492
}
493
-
493
+ /* back-to-top button section */
494
+ .back-to-top {
495
+ position : fixed;
496
+ bottom : 30px ;
497
+ right : 30px ;
498
+ background : linear-gradient (135deg , # 2563eb, # 3b82f6 );
499
+ color : white;
500
+ border : none;
501
+ border-radius : 50% ;
502
+ width : 60px ;
503
+ height : 60px ;
504
+ font-size : 24px ;
505
+ cursor : pointer;
506
+ opacity : 0 ;
507
+ visibility : hidden;
508
+ transition : all 0.3s ease;
509
+ box-shadow : 0 4px 15px rgba (0 , 0 , 0 , 0.2 );
510
+ z-index : 1000 ;
511
+ display : flex;
512
+ align-items : center;
513
+ justify-content : center;
514
+ }
515
+
516
+ .back-to-top .show {
517
+ opacity : 1 ;
518
+ visibility : visible;
519
+ transform : translateY (0 );
520
+ }
521
+
522
+ .back-to-top : hover {
523
+ transform : translateY (-3px );
524
+ box-shadow : 0 6px 20px rgba (0 , 0 , 0 , 0.3 );
525
+ background : linear-gradient (135deg , # 1481ca );
526
+ }
527
+
528
+ .back-to-top : active {
529
+ transform : translateY (-1px );
530
+ }
531
+
532
+ /* Arrow icon */
533
+ .back-to-top ::before {
534
+ content : '↑' ;
535
+ font-weight : bold;
536
+ }
537
+
538
+ /* Responsive */
539
+ @media (max-width : 768px ) {
540
+ .container {
541
+ margin : 10px ;
542
+ border-radius : 0 ;
543
+ }
544
+
545
+ .header , .section {
546
+ padding : 20px ;
547
+ }
548
+
549
+ .back-to-top {
550
+ bottom : 20px ;
551
+ right : 20px ;
552
+ width : 50px ;
553
+ height : 50px ;
554
+ font-size : 20px ;
555
+ }
556
+ }
494
557
@media print {
495
558
.no-print {
496
559
display : none;
You can’t perform that action at this time.
0 commit comments