1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-22 05:03:16 +02:00
This commit is contained in:
Heinrich Fenkart
2014-10-26 03:17:19 +01:00
parent 0e991ccba2
commit 44cc763229
6 changed files with 24 additions and 14 deletions

15
dist/js/bootstrap.js vendored
View File

@@ -1821,8 +1821,9 @@ if (typeof jQuery === 'undefined') {
return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
}
if (activeTarget && scrollTop <= offsets[0]) {
return activeTarget != (i = targets[0]) && this.activate(i)
if (activeTarget && scrollTop < offsets[0]) {
this.activeTarget = null
return this.clear()
}
for (i = offsets.length; i--;) {
@@ -1836,9 +1837,7 @@ if (typeof jQuery === 'undefined') {
ScrollSpy.prototype.activate = function (target) {
this.activeTarget = target
$(this.selector)
.parentsUntil(this.options.target, '.active')
.removeClass('active')
this.clear()
var selector = this.selector +
'[data-target="' + target + '"],' +
@@ -1857,6 +1856,12 @@ if (typeof jQuery === 'undefined') {
active.trigger('activate.bs.scrollspy')
}
ScrollSpy.prototype.clear = function () {
$(this.selector)
.parentsUntil(this.options.target, '.active')
.removeClass('active')
}
// SCROLLSPY PLUGIN DEFINITION
// ===========================