fix js error

This commit is contained in:
qingwei.li 2016-11-20 22:55:20 +08:00
commit c773b71832

View file

@ -35,8 +35,9 @@ function scrollActiveSidebar () {
highlight() highlight()
function scrollIntoView () { function scrollIntoView () {
var id = window.location.hash.slice(1) const id = window.location.hash.slice(1)
var section = document.querySelector('#' + id) if (!id) return
const section = document.querySelector('#' + id)
if (section) section.scrollIntoView() if (section) section.scrollIntoView()
} }