0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-19 16:54:24 +01:00

Update affix properly on scrollspy speedy scroll to top of page #11310

Fix scrollspy.js so as affix is updated properly when user scrolls fast
to top of page.

A fix for issue #11310.
This commit is contained in:
Chris Ziogas 2013-11-04 19:09:48 +02:00
parent aeee718247
commit ed5dbf1b2b
3 changed files with 9 additions and 1 deletions

View File

@ -1665,6 +1665,10 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
return activeTarget != (i = targets.last()[0]) && this.activate(i)
}
if (activeTarget && scrollTop <= offsets[0]) {
return activeTarget != (i = targets.first()[0]) && this.activate(i)
}
for (i = offsets.length; i--;) {
activeTarget != targets[i]
&& scrollTop >= offsets[i]

File diff suppressed because one or more lines are too long

View File

@ -84,6 +84,10 @@
return activeTarget != (i = targets.last()[0]) && this.activate(i)
}
if (activeTarget && scrollTop <= offsets[0]) {
return activeTarget != (i = targets.first()[0]) && this.activate(i)
}
for (i = offsets.length; i--;) {
activeTarget != targets[i]
&& scrollTop >= offsets[i]