diff --git a/themes/Hexo/components/TopNav.js b/themes/Hexo/components/TopNav.js index b2b73433..153d1123 100644 --- a/themes/Hexo/components/TopNav.js +++ b/themes/Hexo/components/TopNav.js @@ -27,7 +27,7 @@ const TopNav = (props) => { const scrollS = window.scrollY const nav = document.querySelector('#sticky-nav') const header = document.querySelector('#header') - const showNav = (scrollS > 0 && scrollS < windowTop) || (header && scrollS < 5) // 非首页无大图时影藏顶部 滚动条置顶时隐藏 + const showNav = scrollS <= windowTop || scrollS < 5 || (header && scrollS <= header.clientHeight)// 非首页无大图时影藏顶部 滚动条置顶时隐藏 if (!showNav) { nav && nav.classList.replace('top-0', '-top-20') @@ -41,7 +41,7 @@ const TopNav = (props) => { // 监听滚动 useEffect(() => { if (CONFIG_HEXO.NAV_TYPE === 'autoCollapse') { - scrollTrigger() + // scrollTrigger() window.addEventListener('scroll', scrollTrigger) } return () => { @@ -100,7 +100,7 @@ const TopNav = (props) => { {/* 右侧功能 */}
-
+
{ isOpen ? : }