Update index.html
Browse files- index.html +17 -18
index.html
CHANGED
|
@@ -26,12 +26,14 @@
|
|
| 26 |
}
|
| 27 |
|
| 28 |
header {
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
| 35 |
}
|
| 36 |
|
| 37 |
header h1 {
|
|
@@ -460,21 +462,18 @@ themeSwitch.addEventListener('change', () => {
|
|
| 460 |
});
|
| 461 |
}
|
| 462 |
|
| 463 |
-
window.
|
|
|
|
|
|
|
| 464 |
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 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 |
-
|
| 473 |
-
|
| 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>
|