diff --git a/common/common.css b/common/common.css index b6495bd..f989224 100644 --- a/common/common.css +++ b/common/common.css @@ -76,11 +76,19 @@ body { left: 0; width: 100%; z-index: 9999; - /* 深色毛玻璃 Header,与下拉菜单统一风格 */ - background: rgba(10, 12, 22, 0.92); - backdrop-filter: blur(16px); - -webkit-backdrop-filter: blur(16px); - box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06); + background: transparent; + backdrop-filter: none; + -webkit-backdrop-filter: none; + box-shadow: none; + transition: background 0.3s ease, backdrop-filter 0.3s ease, box-shadow 0.3s ease; +} + +/* 滚动后变半透明毛玻璃 */ +.nav-shadow.scrolled { + background: rgba(10, 12, 22, 0.75); + backdrop-filter: blur(20px); + -webkit-backdrop-filter: blur(20px); + box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04); } .nav-header { diff --git a/common/common.js b/common/common.js index 140b743..af8729c 100644 --- a/common/common.js +++ b/common/common.js @@ -126,6 +126,16 @@ $(function () { location.href = url; }; function initHeader() { + // 滚动时导航栏变半透明毛玻璃 + var navShadow = document.querySelector('.nav-shadow'); + window.addEventListener('scroll', function () { + if (window.scrollY > 10) { + navShadow.classList.add('scrolled'); + } else { + navShadow.classList.remove('scrolled'); + } + }); + let showIndex = 0; let hoverTimer = null; let leaveTimer = null;