fix js error

This commit is contained in:
qingwei.li
2016-11-20 22:55:20 +08:00
parent cd7a44f651
commit c773b71832
+3 -2
View File
@@ -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()
}