This commit is contained in:
2026-02-08 19:03:16 +08:00
parent 1757d89c68
commit 6361ba484c
3 changed files with 107 additions and 73 deletions

View File

@@ -1,4 +1,5 @@
nav#nav nav#nav
//- 左侧区域:包含指纹菜单和网站名
span#blog-info span#blog-info
#ls-menu-container #ls-menu-container
i.fas.fa-fingerprint i.fas.fa-fingerprint
@@ -26,18 +27,18 @@ nav#nav
img.site-icon(src=url_for(theme.nav.logo) alt='Logo') img.site-icon(src=url_for(theme.nav.logo) alt='Logo')
if theme.nav.display_title if theme.nav.display_title
span.site-name=config.title span.site-name=config.title
if globalPageType === 'post' && theme.nav.display_post_title
a.nav-page-title(href=url_for('/'))
span.site-name=(page.title || config.title)
span.site-name
i.fa-solid.fa-circle-arrow-left
span= ' ' + _p('post.back_to_home')
#menus //- 中间区域:关键!必须在 nav 下一级,以便 JS 切换类名
if theme.menu if globalPageType === 'post' && theme.nav.display_post_title
!= partial('includes/header/menu_item', {}, {cache: true}) a.nav-page-title(href='javascript:void(0);' onclick='btf.scrollToDest(0, 500)')
span.site-name=(page.title || config.title)
//- 右侧区域
#nav-right #nav-right
if theme.menu
#menus
!= partial('includes/header/menu_item', {}, {cache: true})
if theme.search.use || true if theme.search.use || true
#random-post-button #random-post-button
a.site-page.social-icon#random-post-link(href='javascript:void(0);' onclick='randomPost()') a.site-page.social-icon#random-post-link(href='javascript:void(0);' onclick='randomPost()')

View File

@@ -1,3 +1,65 @@
#nav-right{
flex:1 1 auto;
justify-content: flex-end;
margin-left: auto;
display: flex;
flex-wrap:nowrap;
}
/* 导航栏居中 */
#sidebar #sidebar-menus .menus_items .menus_item {
margin: 10px 0;
}
#sidebar #sidebar-menus .menus_items a.site-page {
padding-left: 0;
}
#sidebar #sidebar-menus .menus_items .site-page {
position: relative;
display: block;
padding: 6px 30px 6px 22px;
color: var(--font-color);
font-size: 1.15em;
border: var(--style-border-always);
background: var(--icat-card-bg);
font-size: 14px;
border-radius: 12px;
}
#sidebar #sidebar-menus .menus_items .site-page i:first-child {
text-align: left;
padding-left: 10px;
}
#nav #menus {
display: flex;
justify-content: center;
width: 100%;
position: absolute;
left: 0;
margin: 0;
transform: translateZ(0);
}
#nav #blog-info {
flex-wrap: nowrap;
display: flex;
align-items: center;
z-index: 102;
max-width: fit-content;
}
@media screen and (max-width: 900px) {
#nav {
padding: 0 15px;
}
#nav-group {
padding: 0 0.2rem;
}
#rightside {
right: -42px;
}
}
/* IPAD菜单栏调整 */
/* 1. 容器溢出穿透 */ /* 1. 容器溢出穿透 */
#nav, #blog-info, #nav-group { #nav, #blog-info, #nav-group {
overflow: visible !important; overflow: visible !important;
@@ -113,3 +175,37 @@
color: #ccc !important; color: #ccc !important;
background: rgba(255, 255, 255, 0.05); background: rgba(255, 255, 255, 0.05);
} }
/* --- 附加补丁:确保文章标题正常显示且居中 --- */
/* 1. 当文章标题显示类名触发时,确保它能浮现 */
#nav.show-title .nav-page-title {
display: flex !important;
opacity: 1 !important;
visibility: visible !important;
/* 强制居中,不影响你原本的 blog-info 和 nav-right */
position: absolute !important;
left: 50% !important;
transform: translateX(-50%) !important;
white-space: nowrap !important;
z-index: 1000 !important; /* 确保层级高于你原本的 menus */
}
/* 2. 滚动时自动隐藏原本占据 100% 宽度的菜单和站点标题,防止重叠 */
#nav.show-title #menus,
#nav.show-title .nav-site-title {
opacity: 0 !important;
visibility: hidden !important;
pointer-events: none !important;
}
/* 3. 修正文章标题的基础状态,防止它在页面顶端时乱入 */
#nav .nav-page-title {
display: none; /* 默认隐藏,由 show-title 类名控制 */
transition: opacity 0.3s ease;
}
/* 4. 保持你原本 blog-info 的溢出显示,确保指纹菜单可用 */
#nav #blog-info {
overflow: visible !important;
}

View File

@@ -364,69 +364,6 @@
background-size: cover; background-size: cover;
} }
#nav-right{
flex:1 1 auto;
justify-content: flex-end;
margin-left: auto;
display: flex;
flex-wrap:nowrap;
}
/* 导航栏居中 */
#sidebar #sidebar-menus .menus_items .menus_item {
margin: 10px 0;
}
#sidebar #sidebar-menus .menus_items a.site-page {
padding-left: 0;
}
#sidebar #sidebar-menus .menus_items .site-page {
position: relative;
display: block;
padding: 6px 30px 6px 22px;
color: var(--font-color);
font-size: 1.15em;
border: var(--style-border-always);
background: var(--icat-card-bg);
font-size: 14px;
border-radius: 12px;
}
#sidebar #sidebar-menus .menus_items .site-page i:first-child {
text-align: left;
padding-left: 10px;
}
#nav #menus {
display: flex;
justify-content: center;
width: 100%;
position: absolute;
left: 0;
margin: 0;
transform: translateZ(0);
}
#nav #blog-info {
flex-wrap: nowrap;
display: flex;
align-items: center;
z-index: 102;
max-width: fit-content;
}
@media screen and (max-width: 900px) {
#nav {
padding: 0 15px;
}
#nav-group {
padding: 0 0.2rem;
}
#rightside {
right: -42px;
}
}
/* IPAD菜单栏调整 */
/*https://codepen.io/poojanahelia/pen/Exabvdy*/
#footer { #footer {
background-color: rgba(0, 0, 0, 0); /* 修改透明色 */ background-color: rgba(0, 0, 0, 0); /* 修改透明色 */
color: #fff; color: #fff;