mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-20 20:00:36 +03:00
second try
This commit is contained in:
+2
-1
@@ -127,7 +127,6 @@ class ScrollSpy extends BaseComponent {
|
|||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
const root = this._rootElement || window
|
const root = this._rootElement || window
|
||||||
const height = observableSection.offsetTop - this._element.offsetTop
|
const height = observableSection.offsetTop - this._element.offsetTop
|
||||||
window.history.pushState(null, null, event.target.hash)
|
|
||||||
if (root.scrollTo) {
|
if (root.scrollTo) {
|
||||||
root.scrollTo({ top: height, behavior: 'smooth' })
|
root.scrollTo({ top: height, behavior: 'smooth' })
|
||||||
return
|
return
|
||||||
@@ -222,6 +221,8 @@ class ScrollSpy extends BaseComponent {
|
|||||||
|
|
||||||
this._clearActiveClass(this._config.target)
|
this._clearActiveClass(this._config.target)
|
||||||
this._activeTarget = target
|
this._activeTarget = target
|
||||||
|
|
||||||
|
window.history.pushState(null, null, target.hash)
|
||||||
target.classList.add(CLASS_NAME_ACTIVE)
|
target.classList.add(CLASS_NAME_ACTIVE)
|
||||||
this._activateParents(target)
|
this._activateParents(target)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user