Files
BlackFruit-UI/css/nav-mega-menu.css
yiqiu bf5cc83353
All checks were successful
continuous-integration/drone/push Build is passing
背景色优化
2026-01-10 17:14:19 +08:00

481 lines
7.7 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* 三级导航菜单样式 - 阿里云风格两栏布局 */
/* 导航容器 */
.nav-cont {
position: absolute;
top: 100%;
left: 0;
width: 100%;
background: linear-gradient(to bottom, #f8fbff 0%, #fff 100%);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
z-index: 1000;
overflow: hidden;
transition: height 0.3s ease-out;
}
/* Mega Menu 两栏布局 */
.nav-cont-menu.mega-menu {
display: none;
min-height: 400px;
}
.nav-content {
display: flex;
max-width: 1400px;
margin: 0 auto;
min-height: 400px;
}
/* 左侧二级菜单栏 */
.nav-left-sidebar {
width: 200px;
background: #f7f8fa;
border-right: 1px solid #e8e8e8;
flex-shrink: 0;
}
/* 二级菜单项 */
.nav-category-item {
position: relative;
display: block;
padding: 16px 20px;
color: #333;
font-size: 14px;
text-decoration: none;
border-left: 3px solid transparent;
transition: all 0.2s ease;
cursor: pointer;
}
.nav-category-item:hover,
.nav-category-item.active {
background: #fff;
border-left-color: #1890ff;
color: #1890ff;
}
.nav-category-item .category-icon {
display: inline-block;
width: 20px;
height: 20px;
margin-right: 8px;
vertical-align: middle;
}
.nav-category-item .category-icon img {
width: 100%;
height: 100%;
object-fit: contain;
}
.nav-category-name {
font-weight: 500;
}
.nav-category-desc {
font-size: 12px;
color: #999;
margin-top: 2px;
display: block;
}
/* 右侧三级菜单区域 */
.nav-right-content {
flex: 1;
padding: 24px 32px;
background: linear-gradient(135deg, #fafcff 0%, #ffffff 100%);
overflow-y: auto;
max-height: 500px;
}
/* 三级菜单容器 */
.nav-third-panel {
display: none;
}
.nav-third-panel.active {
display: block;
animation: fadeInRight 0.3s ease;
}
/* 三级菜单标题 */
.nav-third-title {
font-size: 16px;
font-weight: 600;
color: #333;
margin-bottom: 16px;
padding-bottom: 12px;
border-bottom: 2px solid #1890ff;
display: inline-block;
}
/* 三级菜单网格布局 */
.nav-third-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 12px 24px;
margin-top: 20px;
}
/* 三级菜单项 */
.nav-third-item {
margin: 0;
width: 100%;
}
.nav-third-link {
display: flex;
align-items: center;
width: 100%;
padding: 10px 12px;
border-radius: 4px;
color: #333;
font-size: 13px;
text-decoration: none;
transition: all 0.2s ease;
border: 1px solid transparent;
box-sizing: border-box;
}
.nav-third-link:hover {
background: #e6f7ff;
border-color: #91d5ff;
color: #1890ff;
transform: translateX(4px);
}
.nav-third-link::before {
content: '';
font-size: 16px;
color: #1890ff;
margin-right: 6px;
transition: transform 0.2s ease;
}
.nav-third-link:hover::before {
transform: translateX(2px);
}
.nav-third-name {
flex: 1;
font-weight: 500;
}
.nav-third-desc {
font-size: 11px;
color: #999;
margin-left: 8px;
}
/* 空状态 */
.nav-right-empty {
display: flex;
align-items: center;
justify-content: center;
height: 300px;
color: #999;
font-size: 14px;
}
/* 旧版二级菜单样式(无三级菜单时使用) */
.nav-item-box {
display: flex;
align-items: center;
gap: 12px;
padding: 16px 20px;
transition: all 0.2s ease;
text-decoration: none;
color: #333;
border-left: 3px solid transparent;
}
.nav-item-box:hover {
background: #fff;
border-left-color: #1890ff;
color: #1890ff;
}
.nav-item-box img {
width: 20px;
height: 20px;
flex-shrink: 0;
}
.item-box-title .title {
font-size: 14px;
font-weight: 500;
margin-bottom: 2px;
}
.item-box-title .desc {
font-size: 12px;
color: #999;
}
/* 空菜单占位 */
.nav-cont-menu.nav-cont-empty {
display: none;
}
/* 动画效果 */
@keyframes fadeInRight {
from {
opacity: 0;
transform: translateX(10px);
}
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 #e8e8e8;
}
.nav-right-content {
padding: 16px;
max-height: none;
}
.nav-third-grid {
grid-template-columns: 1fr;
}
}
/* 导航容器 */
.nav-cont {
position: absolute;
top: 100%;
left: 0;
width: 100%;
background: #fff;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
z-index: 1000;
overflow: hidden;
transition: height 0.3s ease-out;
}
/* Mega Menu 内容区 */
.nav-cont-menu.mega-menu {
display: none;
padding: 24px 0;
}
.nav-cont-menu.mega-menu .nav-content {
display: flex;
flex-wrap: wrap;
gap: 32px;
max-width: 1400px;
margin: 0 auto;
padding: 0 20px;
}
/* 二级菜单项(带三级菜单的分类) */
.nav-category {
flex: 0 0 auto;
min-width: 200px;
max-width: 280px;
}
.nav-category-header {
display: flex;
align-items: center;
gap: 12px;
padding: 8px 12px;
margin-bottom: 12px;
border-radius: 6px;
background: linear-gradient(135deg, #f0f7ff 0%, #e6f3ff 100%);
transition: all 0.2s ease;
}
.nav-category-header:hover {
background: linear-gradient(135deg, #e6f3ff 0%, #d9edff 100%);
transform: translateX(2px);
}
.nav-category-icon {
flex-shrink: 0;
width: 32px;
height: 32px;
border-radius: 6px;
overflow: hidden;
}
.nav-category-icon img {
width: 100%;
height: 100%;
object-fit: contain;
}
.nav-category-info {
flex: 1;
min-width: 0;
}
.nav-category-title {
font-size: 14px;
font-weight: 600;
color: #1890ff;
margin-bottom: 2px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.nav-category-desc {
font-size: 12px;
color: #8c8c8c;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* 三级菜单列表 */
.nav-third-level {
padding-left: 12px;
}
.nav-third-item {
margin-bottom: 8px;
}
.nav-third-link {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 12px;
border-radius: 4px;
color: #333;
font-size: 13px;
text-decoration: none;
transition: all 0.2s ease;
position: relative;
}
.nav-third-link::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 3px;
height: 0;
background: #1890ff;
border-radius: 2px;
transition: height 0.2s ease;
}
.nav-third-link:hover {
background: #f5f5f5;
color: #1890ff;
padding-left: 16px;
}
.nav-third-link:hover::before {
height: 16px;
}
.nav-third-name {
flex: 1;
font-weight: 500;
}
.nav-third-desc {
font-size: 11px;
color: #999;
margin-left: auto;
}
/* 没有三级菜单的二级菜单项(旧版兼容) */
.nav-item-box {
display: flex;
align-items: flex-start;
gap: 12px;
padding: 12px 16px;
border-radius: 6px;
transition: all 0.2s ease;
text-decoration: none;
color: #333;
}
.nav-item-box:hover {
background: #f5f5f5;
transform: translateY(-2px);
}
.nav-item-box img {
width: 40px;
height: 40px;
flex-shrink: 0;
border-radius: 4px;
}
.item-box-title .title {
font-size: 14px;
font-weight: 600;
color: #333;
margin-bottom: 4px;
}
.item-box-title .desc {
font-size: 12px;
color: #8c8c8c;
}
/* 空菜单占位 */
.nav-cont-menu.nav-cont-empty {
display: none;
}
/* 响应式调整 */
@media (max-width: 768px) {
.nav-cont {
display: none !important;
}
.nav-cont-menu.mega-menu {
padding: 16px 0;
}
.nav-cont-menu.mega-menu .nav-content {
flex-direction: column;
gap: 16px;
}
.nav-category {
max-width: 100%;
}
}
/* 加载动画 */
@keyframes fadeInDown {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.nav-cont-menu.animated {
animation: fadeInDown 0.3s ease-out;
}