diff options
author | GeoSot <geo.sotis@gmail.com> | 2022-06-11 00:15:52 +0300 |
---|---|---|
committer | GeoSot <geo.sotis@gmail.com> | 2022-06-11 00:15:52 +0300 |
commit | 728aa35613aca49f851824a746d365a75061bc7b (patch) | |
tree | 9f42ba5a12fb0c447fcb3722c77762a5df3f9222 | |
parent | 8b1bfdc3af52a09171b22b7e244cd16ed3c7a4dc (diff) |
-rw-r--r-- | js/src/scrollspy.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js index d003e4e180..00be4ef363 100644 --- a/js/src/scrollspy.js +++ b/js/src/scrollspy.js @@ -127,7 +127,6 @@ class ScrollSpy extends BaseComponent { event.preventDefault() const root = this._rootElement || window const height = observableSection.offsetTop - this._element.offsetTop - window.history.pushState(null, null, event.target.hash) if (root.scrollTo) { root.scrollTo({ top: height, behavior: 'smooth' }) return @@ -222,6 +221,8 @@ class ScrollSpy extends BaseComponent { this._clearActiveClass(this._config.target) this._activeTarget = target + + window.history.pushState(null, null, target.hash) target.classList.add(CLASS_NAME_ACTIVE) this._activateParents(target) |