Fixed sidebar bug when the coverpage exist

This commit is contained in:
qingwei.li 2017-01-10 23:48:12 +08:00
commit 90b490c9c1
2 changed files with 7 additions and 1 deletions

View file

@ -48,7 +48,7 @@ export function scrollActiveSidebar () {
li.classList.add('active')
active = li
!hoveredOverSidebar && active.scrollIntoView()
!hoveredOverSidebar && sticky.isSticky && active.scrollIntoView()
}
window.removeEventListener('scroll', highlight)
@ -125,8 +125,10 @@ export function sticky () {
return (function () {
if (window.pageYOffset >= coverHeight || dom.classList.contains('hidden')) {
document.body.classList.add('sticky')
sticky.isSticky = true
} else {
document.body.classList.remove('sticky')
sticky.isSticky = false
}
})()
}