ilhamdev commited on
Commit
518be3e
1 Parent(s): 9dcc472

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +31 -0
index.html CHANGED
@@ -294,6 +294,15 @@
294
  background-color: #007aff; /* Ganti warna latar belakang saat tombol dihover */
295
  border: 2px solid #007aff; /* Ganti warna border saat tombol dihover */
296
  }
 
 
 
 
 
 
 
 
 
297
 
298
  </style>
299
  </head>
@@ -457,7 +466,29 @@ themeSwitch.addEventListener('change', () => {
457
  console.error('Failed to copy: ', err);
458
  });
459
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
460
 
 
461
  </script>
462
  </body>
463
  </html>
 
294
  background-color: #007aff; /* Ganti warna latar belakang saat tombol dihover */
295
  border: 2px solid #007aff; /* Ganti warna border saat tombol dihover */
296
  }
297
+ header {
298
+ /* existing styles */
299
+ transition: height 0.3s ease;
300
+ }
301
+
302
+ .dark-mode header {
303
+ /* existing styles */
304
+ height: 40px;
305
+ }
306
 
307
  </style>
308
  </head>
 
466
  console.error('Failed to copy: ', err);
467
  });
468
  }
469
+ const themeSwitch = document.getElementById('theme-switch');
470
+ const pageHeader = document.getElementById('page-header');
471
+
472
+ function toggleDarkMode() {
473
+ document.body.classList.toggle('dark-mode');
474
+
475
+ // Change header behavior on scroll
476
+ if (document.body.classList.contains('dark-mode')) {
477
+ window.addEventListener('scroll', () => {
478
+ if (window.scrollY > 0 && window.scrollY < 150) {
479
+ pageHeader.style.height = `calc(40px + ${window.scrollY * 0.5}px)`;
480
+ } else if (window.scrollY >= 150) {
481
+ pageHeader.style.height = '80px';
482
+ } else {
483
+ pageHeader.style.height = '40px';
484
+ }
485
+ });
486
+ } else {
487
+ window.removeEventListener('scroll', headerScrollFunction);
488
+ }
489
+ }
490
 
491
+ themeSwitch.addEventListener('change', toggleDarkMode);
492
  </script>
493
  </body>
494
  </html>