From 972633aa9eff30e34b0fa621b620ea0926349a78 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Tue, 8 Mar 2022 15:44:48 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Hexo=20=E5=AF=BC=E8=88=AA=E6=A0=8F=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/Hexo/components/TopNav.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 ? : }
From 69dc390b0e6e0d2e83b17a083b99ae70aafcfd63 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Tue, 8 Mar 2022 17:29:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?HEXO=20=E5=AF=BC=E8=88=AA=E6=A0=8F=E6=B7=A1?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/Hexo/components/Collapse.js | 4 ++++ themes/Hexo/components/HeaderArticle.js | 2 +- themes/Hexo/components/TopNav.js | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/themes/Hexo/components/Collapse.js b/themes/Hexo/components/Collapse.js index 8af6f100..769ac602 100644 --- a/themes/Hexo/components/Collapse.js +++ b/themes/Hexo/components/Collapse.js @@ -5,6 +5,10 @@ const Collapse = props => { const collapseRef = useRef(null) const collapseSection = element => { const sectionHeight = element.scrollHeight + const currentHeight = element.style.height + if (currentHeight === '0px') { + return + } requestAnimationFrame(function () { element.style.height = sectionHeight + 'px' requestAnimationFrame(function () { diff --git a/themes/Hexo/components/HeaderArticle.js b/themes/Hexo/components/HeaderArticle.js index 5476b686..ffb43bd7 100644 --- a/themes/Hexo/components/HeaderArticle.js +++ b/themes/Hexo/components/HeaderArticle.js @@ -36,7 +36,7 @@ export default function HeaderArticle ({ post }) { return (