From c773b718328ba89d1f89be2b66793f3fd075fec1 Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Sun, 20 Nov 2016 22:55:20 +0800 Subject: [PATCH] fix js error --- src/bind-event.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bind-event.js b/src/bind-event.js index a9f97e42..4dd52191 100644 --- a/src/bind-event.js +++ b/src/bind-event.js @@ -35,8 +35,9 @@ function scrollActiveSidebar () { highlight() function scrollIntoView () { - var id = window.location.hash.slice(1) - var section = document.querySelector('#' + id) + const id = window.location.hash.slice(1) + if (!id) return + const section = document.querySelector('#' + id) if (section) section.scrollIntoView() }