diff --git a/src/Manager.js b/src/Manager.js index 6d74f72..78378fc 100644 --- a/src/Manager.js +++ b/src/Manager.js @@ -13,6 +13,7 @@ class Manager { constructor() { this.anchors = {} this.forcedHash = false + this.forcedScroll = false; this.config = defaultConfig this.scrollHandler = debounce(this.handleScroll, 100) @@ -63,7 +64,9 @@ class Manager { const {offset, keepLastAnchorHash} = this.config const bestAnchorId = getBestAnchorGivenScrollLocation(this.anchors, offset) - if (bestAnchorId && getHash() !== bestAnchorId) { + if (this.forcedScroll) { + this.forcedScroll = false; + } else if (bestAnchorId && getHash() !== bestAnchorId) { this.forcedHash = true updateHash(bestAnchorId, false) } else if (!bestAnchorId && !keepLastAnchorHash) { @@ -82,6 +85,7 @@ class Manager { goToSection = (id) => { let element = this.anchors[id] if (element) { + this.forcedScroll = true; jump(element, { duration: this.config.scrollDuration, offset: this.config.offset,