mirror of
https://github.com/twbs/bootstrap.git
synced 2022-11-09 12:25:43 -05: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:
parent
aeee718247
commit
ed5dbf1b2b
3 changed files with 9 additions and 1 deletions
4
dist/js/bootstrap.js
vendored
4
dist/js/bootstrap.js
vendored
|
@ -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]
|
||||
|
|
2
dist/js/bootstrap.min.js
vendored
2
dist/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -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]
|
||||
|
|
Loading…
Add table
Reference in a new issue