From b8628db521120ab8815453666364453f9c12116e Mon Sep 17 00:00:00 2001 From: bhaskarmelkani Date: Thu, 22 Jun 2017 16:46:56 +0200 Subject: [PATCH] fix: fix issue with scrollIntoView --- source/script/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/script/main.js b/source/script/main.js index 856f6b4..9b2b7df 100644 --- a/source/script/main.js +++ b/source/script/main.js @@ -137,7 +137,7 @@ var atRoot = location.pathname === '/' || location.pathname === '/index.html'; if (!atRoot || location.hash !== '') { // hexo rewrites the URLs to be relative, so the current page has href="". - document.querySelector('.item-toc a[href=""]').scrollIntoView(); + document.querySelector('.item-toc a[href=""]') && document.querySelector('.item-toc a[href=""]').scrollIntoView(); } // version select