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 @@ -346,6 +346,36 @@ toggle.addEventListener('click', () => {
346
346
localStorage . setItem ( 'theme' , 'light' ) ;
347
347
}
348
348
} ) ;
349
+ // back to top section
350
+ const backToTopButton = document . getElementById ( 'backToTop' ) ;
351
+
352
+ // Show/hide button based on scroll position
353
+ window . addEventListener ( 'scroll' , function ( ) {
354
+ if ( window . pageYOffset > 300 ) {
355
+ backToTopButton . classList . add ( 'show' ) ;
356
+ } else {
357
+ backToTopButton . classList . remove ( 'show' ) ;
358
+ }
359
+ } ) ;
360
+
361
+ // Smooth scroll to top when button is clicked
362
+ backToTopButton . addEventListener ( 'click' , function ( ) {
363
+ window . scrollTo ( {
364
+ top : 0 ,
365
+ behavior : 'smooth'
366
+ } ) ;
367
+ } ) ;
368
+
369
+ // Optional: Add keyboard support (Enter or Space key)
370
+ backToTopButton . addEventListener ( 'keydown' , function ( e ) {
371
+ if ( e . key === 'Enter' || e . key === ' ' ) {
372
+ e . preventDefault ( ) ;
373
+ window . scrollTo ( {
374
+ top : 0 ,
375
+ behavior : 'smooth'
376
+ } ) ;
377
+ }
378
+ } ) ;
349
379
// --- Draggable Resume Section Reordering ---
350
380
document . addEventListener ( "DOMContentLoaded" , ( ) => {
351
381
const container = document . getElementById ( "resume-sections" ) ;
Original file line number Diff line number Diff line change @@ -383,7 +383,70 @@ body.dark .footer-link {
383
383
margin-bottom : 0.5rem ;
384
384
display : block;
385
385
}
386
-
386
+ /* back-to-top button section */
387
+ .back-to-top {
388
+ position : fixed;
389
+ bottom : 30px ;
390
+ right : 30px ;
391
+ background : linear-gradient (135deg , # 2563eb, # 3b82f6 );
392
+ color : white;
393
+ border : none;
394
+ border-radius : 50% ;
395
+ width : 60px ;
396
+ height : 60px ;
397
+ font-size : 24px ;
398
+ cursor : pointer;
399
+ opacity : 0 ;
400
+ visibility : hidden;
401
+ transition : all 0.3s ease;
402
+ box-shadow : 0 4px 15px rgba (0 , 0 , 0 , 0.2 );
403
+ z-index : 1000 ;
404
+ display : flex;
405
+ align-items : center;
406
+ justify-content : center;
407
+ }
408
+
409
+ .back-to-top .show {
410
+ opacity : 1 ;
411
+ visibility : visible;
412
+ transform : translateY (0 );
413
+ }
414
+
415
+ .back-to-top : hover {
416
+ transform : translateY (-3px );
417
+ box-shadow : 0 6px 20px rgba (0 , 0 , 0 , 0.3 );
418
+ background : linear-gradient (135deg , # 1481ca );
419
+ }
420
+
421
+ .back-to-top : active {
422
+ transform : translateY (-1px );
423
+ }
424
+
425
+ /* Arrow icon */
426
+ .back-to-top ::before {
427
+ content : '↑' ;
428
+ font-weight : bold;
429
+ }
430
+
431
+ /* Responsive */
432
+ @media (max-width : 768px ) {
433
+ .container {
434
+ margin : 10px ;
435
+ border-radius : 0 ;
436
+ }
437
+
438
+ .header , .section {
439
+ padding : 20px ;
440
+ }
441
+
442
+ .back-to-top {
443
+ bottom : 20px ;
444
+ right : 20px ;
445
+ width : 50px ;
446
+ height : 50px ;
447
+ font-size : 20px ;
448
+ }
449
+ }
387
450
@media print {
388
451
.no-print {
389
452
display : none !important ;
You can’t perform that action at this time.
0 commit comments