From 869cd0a3c947474fea0be551d3f99285f8793b32 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Fri, 29 Apr 2022 13:26:52 +0800 Subject: [PATCH] =?UTF-8?q?bug=20=E7=A9=BAheader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/hexo/components/HeaderArticle.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/themes/hexo/components/HeaderArticle.js b/themes/hexo/components/HeaderArticle.js index 191184cb..8513419d 100644 --- a/themes/hexo/components/HeaderArticle.js +++ b/themes/hexo/components/HeaderArticle.js @@ -41,6 +41,9 @@ export default function HeaderArticle({ post, siteInfo }) { if (!isDarkMode) { const stickyNavElement = document.getElementById('sticky-nav') const header = document.querySelector('#header') + if (!header || !stickyNavElement) { + return + } if (window.scrollY < header.clientHeight) { stickyNavElement?.classList?.add('dark') } else {