取消导航栏悬浮效果

This commit is contained in:
lwt
2026-05-09 10:45:14 +08:00
parent 56dea052d9
commit 4142cef39f
3 changed files with 1 additions and 15 deletions
-4
View File
@@ -7,9 +7,6 @@
} }
.site-header { .site-header {
position: sticky;
top: 16px;
z-index: 20;
display: grid; display: grid;
grid-template-columns: auto 1fr auto; grid-template-columns: auto 1fr auto;
gap: 26px; gap: 26px;
@@ -101,7 +98,6 @@
} }
.site-header { .site-header {
top: 10px;
border-radius: 18px; border-radius: 18px;
} }
-10
View File
@@ -1,15 +1,5 @@
const year = document.querySelector("#year"); const year = document.querySelector("#year");
const header = document.querySelector("[data-header]");
if (year) { if (year) {
year.textContent = new Date().getFullYear(); year.textContent = new Date().getFullYear();
} }
if (header) {
const updateHeader = () => {
header.classList.toggle("is-scrolled", window.scrollY > 8);
};
updateHeader();
window.addEventListener("scroll", updateHeader, { passive: true });
}
+1 -1
View File
@@ -11,7 +11,7 @@
<link rel="stylesheet" href="assets/css/components.css" /> <link rel="stylesheet" href="assets/css/components.css" />
</head> </head>
<body> <body>
<header class="site-header" data-header> <header class="site-header">
<a class="brand" href="#" aria-label="sumi.work 首页"> <a class="brand" href="#" aria-label="sumi.work 首页">
<span class="brand-mark" aria-hidden="true">S</span> <span class="brand-mark" aria-hidden="true">S</span>
<span>sumi.work</span> <span>sumi.work</span>