ilhamdev commited on
Commit
8208487
1 Parent(s): 506d87b

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +17 -18
index.html CHANGED
@@ -26,12 +26,14 @@
26
  }
27
 
28
  header {
29
- background: linear-gradient(90deg, #4a90e2, #007aff);
30
- color: #fff;
31
- padding: 40px 0;
32
- text-align: center;
33
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
34
- transition: height 0.3s ease; /* Add transition for header height */
 
 
35
  }
36
 
37
  header h1 {
@@ -460,21 +462,18 @@ themeSwitch.addEventListener('change', () => {
460
  });
461
  }
462
 
463
- window.onscroll = function() {scrollFunction()};
 
 
464
 
465
- function scrollFunction() {
466
- if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) {
467
- document.querySelector("header").style.padding = "10px 0"; // Menyusut menjadi setengah
468
- document.querySelector("header").style.minHeight = "50px"; // Menetapkan tinggi minimum
469
- document.querySelector("header h1").style.fontSize = "1em"; // Menyusut lebih lanjut
470
- document.querySelector("header h1").style.textAlign = "left"; // Teks berpindah ke kiri
471
  } else {
472
- document.querySelector("header").style.padding = "40px 0";
473
- document.querySelector("header").style.minHeight = "0"; // Menghapus tinggi minimum
474
- document.querySelector("header h1").style.fontSize = "2.5em";
475
- document.querySelector("header h1").style.textAlign = "center";
476
  }
477
- }
478
 
479
 
480
  </script>
 
26
  }
27
 
28
  header {
29
+ position: fixed;
30
+ top: 0;
31
+ left: 0;
32
+ width: 100%;
33
+ }
34
+
35
+ main {
36
+ padding-top: 70px; /* Ganti dengan tinggi header Anda */
37
  }
38
 
39
  header h1 {
 
462
  });
463
  }
464
 
465
+ window.addEventListener('scroll', function() {
466
+ var scrollPosition = window.scrollY || document.documentElement.scrollTop;
467
+ var headerText = document.querySelector('header h1');
468
 
469
+ if (scrollPosition <= 50) {
470
+ // Jika posisi scroll kurang dari atau sama dengan 50
471
+ headerText.style.fontSize = '2.5em'; // Ukuran font awal
 
 
 
472
  } else {
473
+ // Jika posisi scroll lebih dari 50
474
+ headerText.style.fontSize = '1.25em'; // Ukuran font menyusut
 
 
475
  }
476
+ });
477
 
478
 
479
  </script>