From 728aa35613aca49f851824a746d365a75061bc7b Mon Sep 17 00:00:00 2001 From: GeoSot Date: Sat, 11 Jun 2022 00:15:52 +0300 Subject: [PATCH] second try --- js/src/scrollspy.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js index d003e4e18..00be4ef36 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)