mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-14 18:42:30 +03:00
feat(Scrollspy): add history state in every click, when smoothScroll is activated
This commit is contained in:
@@ -127,6 +127,7 @@ 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
|
||||||
|
|||||||
Reference in New Issue
Block a user