1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-08 22:56:46 +02:00

Closes #21055: Prevents ScrollSpy from clearing active item when Safari rubberbands (#21056)

When the rubberband effect causes Safari to scroll past the top of the
page, the value of scrollTop becomes negative. If the offset of the first
ScrollSpy target is 0 - essentially if the target is at the top of the
page - then ScrollSpy should not clear the active item. Conceptually, the
first item should remain active when rubberbanding past the top of the
page.

This commit fixes issue #21055 by verifying the first scrollspy target is
not at the top of the page before clearing the active nav-item.
This commit is contained in:
Rob Ruana
2016-11-27 16:20:33 -08:00
committed by Mark Otto
parent 8d031090d0
commit 5eddb0b0fd
2 changed files with 45 additions and 1 deletions

View File

@@ -221,7 +221,7 @@ const ScrollSpy = (($) => {
return
}
if (this._activeTarget && scrollTop < this._offsets[0]) {
if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
this._activeTarget = null
this._clear()
return