refactor: 导航下拉菜单重构为方案 C 混合型
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
- public/header.html: 去掉左右分栏,改为二级分组标题 + 三级国旗链接网格 - css/nav-mega-menu.css: 居中收窄面板(720px),分组标题+网格布局 - js/nav-third-level.js: 清空旧的面板切换脚本(不再需要) - 下拉面板不再全宽铺开,视觉更精致紧凑
This commit is contained in:
@@ -1,146 +1,105 @@
|
||||
/* ============================================================
|
||||
顶部导航下拉菜单样式 - akile.io 深色毛玻璃风格
|
||||
导航下拉菜单 — 方案 C 混合型
|
||||
二级分组标题 + 三级国旗链接网格,居中收窄面板
|
||||
============================================================ */
|
||||
|
||||
/* 下拉容器 */
|
||||
/* ── 下拉外层容器 ── */
|
||||
.nav-cont {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background: rgba(14, 16, 26, 0.98);
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.06);
|
||||
box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6);
|
||||
z-index: 1000;
|
||||
overflow: hidden;
|
||||
transition: height 0.25s ease-out;
|
||||
height: 0;
|
||||
/* 不设背景,由 inner 负责 */
|
||||
}
|
||||
|
||||
/* Mega Menu 容器 */
|
||||
.nav-cont-menu.mega-menu {
|
||||
display: none;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* inner 布局 */
|
||||
.nav-content {
|
||||
/* ── 下拉内层 —— 居中收窄面板 ── */
|
||||
.nav-dropdown-inner {
|
||||
display: flex;
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
height: 100%;
|
||||
min-height: 320px;
|
||||
justify-content: center;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* ── 左侧二级菜单栏 ── */
|
||||
.nav-left-sidebar {
|
||||
width: 220px;
|
||||
flex-shrink: 0;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border-right: 1px solid rgba(255, 255, 255, 0.06);
|
||||
padding: 16px 8px;
|
||||
overflow-y: auto;
|
||||
/* ── 每个一级导航对应的菜单面板 ── */
|
||||
.nav-cont-menu {
|
||||
display: none;
|
||||
width: 100%;
|
||||
max-width: 720px;
|
||||
margin: 0 auto;
|
||||
background: rgba(14, 16, 26, 0.98);
|
||||
backdrop-filter: blur(24px);
|
||||
-webkit-backdrop-filter: blur(24px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
border-top: none;
|
||||
border-radius: 0 0 14px 14px;
|
||||
box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55),
|
||||
0 0 0 1px rgba(255, 255, 255, 0.04) inset;
|
||||
padding: 20px 0 12px;
|
||||
}
|
||||
|
||||
/* 二级分类项 */
|
||||
.nav-category-item {
|
||||
.nav-cont-menu.nav-cont-empty {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* ── 分组容器 (方案 C 核心) ── */
|
||||
.nav-groups {
|
||||
padding: 0 24px;
|
||||
}
|
||||
|
||||
.nav-group {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.nav-group:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* ── 二级分组标题行 ── */
|
||||
.nav-group-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 11px 14px;
|
||||
color: rgba(203, 213, 225, 0.75);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s ease, color 0.15s ease;
|
||||
gap: 8px;
|
||||
padding: 8px 8px 6px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: rgba(148, 163, 184, 0.7);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
||||
margin-bottom: 6px;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.nav-category-item:hover,
|
||||
.nav-category-item.active {
|
||||
background: rgba(59, 130, 246, 0.12);
|
||||
color: #93C5FD;
|
||||
}
|
||||
|
||||
.nav-category-item .category-icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.nav-category-item .category-icon img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.nav-group-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
object-fit: contain;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.nav-category-name {
|
||||
font-weight: 500;
|
||||
.nav-group-desc {
|
||||
font-weight: 400;
|
||||
font-size: 11px;
|
||||
color: rgba(148, 163, 184, 0.45);
|
||||
letter-spacing: 0;
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
.nav-category-desc {
|
||||
font-size: 12px;
|
||||
color: rgba(148, 163, 184, 0.6);
|
||||
margin-top: 2px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* ── 右侧三级菜单区域 ── */
|
||||
.nav-right-content {
|
||||
flex: 1;
|
||||
padding: 20px 28px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
/* 三级菜单面板 */
|
||||
.nav-third-panel {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.nav-third-panel.active {
|
||||
display: block;
|
||||
animation: navPanelFadeIn 0.2s ease;
|
||||
}
|
||||
|
||||
/* 三级菜单标题 */
|
||||
.nav-third-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: rgba(148, 163, 184, 0.6);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 12px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
/* 三级菜单网格 */
|
||||
.nav-third-grid {
|
||||
/* ── 三级链接网格 ── */
|
||||
.nav-group-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 4px 8px;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
/* 三级菜单项容器 */
|
||||
.nav-cont-menu .nav-third-item {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* 三级菜单链接 - akile 风格:纯行 hover,无卡片 */
|
||||
.nav-cont-menu .nav-third-grid .nav-third-link,
|
||||
.nav-third-panel .nav-third-link {
|
||||
/* ── 三级链接项 ── */
|
||||
.nav-grid-link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
padding: 10px 12px;
|
||||
border-radius: 8px;
|
||||
color: rgba(226, 232, 240, 0.85);
|
||||
@@ -148,23 +107,13 @@
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
transition: background 0.15s ease, color 0.15s ease;
|
||||
box-sizing: border-box;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
/* 无边框、无卡片背景 */
|
||||
background: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.nav-cont-menu .nav-third-grid .nav-third-link::before,
|
||||
.nav-third-panel .nav-third-link::before {
|
||||
content: none; /* 移除旧的 › 箭头前缀 */
|
||||
}
|
||||
|
||||
.nav-cont-menu .nav-third-grid .nav-third-link:hover,
|
||||
.nav-third-panel .nav-third-link:hover {
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
.nav-grid-link:hover {
|
||||
background: rgba(255, 255, 255, 0.07);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
@@ -173,48 +122,42 @@
|
||||
width: 22px;
|
||||
height: 16px;
|
||||
flex-shrink: 0;
|
||||
vertical-align: middle;
|
||||
object-fit: cover;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
/* ── 只有二级菜单时的横向网格(无三级) ── */
|
||||
/* ── 纯二级:简单网格 ── */
|
||||
.nav-simple-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||
gap: 4px 8px;
|
||||
padding: 20px 28px;
|
||||
width: 100%;
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
box-sizing: border-box;
|
||||
gap: 2px;
|
||||
padding: 4px 24px 8px;
|
||||
}
|
||||
|
||||
.nav-simple-grid .nav-simple-item {
|
||||
.nav-simple-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 11px 14px;
|
||||
padding: 10px 12px;
|
||||
border-radius: 8px;
|
||||
color: rgba(226, 232, 240, 0.85);
|
||||
text-decoration: none;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
transition: background 0.15s ease, color 0.15s ease;
|
||||
/* 无卡片边框背景 */
|
||||
background: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.nav-simple-grid .nav-simple-item:hover {
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
.nav-simple-item:hover {
|
||||
background: rgba(255, 255, 255, 0.07);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.nav-simple-icon {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@@ -228,76 +171,26 @@
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: inherit;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.nav-simple-desc {
|
||||
font-size: 12px;
|
||||
color: rgba(148, 163, 184, 0.65);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: rgba(148, 163, 184, 0.6);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
/* ── 菜单底部「更多」区域 ── */
|
||||
.nav-menu-footer {
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.06);
|
||||
padding: 12px 28px;
|
||||
}
|
||||
|
||||
.nav-menu-footer a {
|
||||
font-size: 13px;
|
||||
color: rgba(148, 163, 184, 0.7);
|
||||
text-decoration: none;
|
||||
transition: color 0.15s ease;
|
||||
}
|
||||
|
||||
.nav-menu-footer a:hover {
|
||||
color: #93C5FD;
|
||||
}
|
||||
|
||||
/* ── 空菜单占位 ── */
|
||||
/* ── 空菜单 ── */
|
||||
.nav-cont-menu.nav-cont-empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ── 动画 ── */
|
||||
@keyframes navPanelFadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateX(8px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* ── 响应式 ── */
|
||||
@media (max-width: 768px) {
|
||||
.nav-cont {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.nav-content {
|
||||
flex-direction: column;
|
||||
min-height: auto;
|
||||
}
|
||||
|
||||
.nav-left-sidebar {
|
||||
width: 100%;
|
||||
border-right: none;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
.nav-right-content {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.nav-third-grid {
|
||||
.nav-group-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user