diff --git a/CHANGELOG.md b/CHANGELOG.md index 86321d3..1db406f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.6.1 +### Bug fixes +- Fixed sidebar bug when the coverpage exist + ## 1.6.0 ### Features - Improve sidebar performance. The active item is automatically scrolled in the visible view. diff --git a/src/event.js b/src/event.js index 0bfe514..8028127 100644 --- a/src/event.js +++ b/src/event.js @@ -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 } })() }