diff options
Diffstat (limited to 'bower_components/bootstrap/js/scrollspy.js')
-rw-r--r-- | bower_components/bootstrap/js/scrollspy.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/bower_components/bootstrap/js/scrollspy.js b/bower_components/bootstrap/js/scrollspy.js index db237878..973021a9 100644 --- a/bower_components/bootstrap/js/scrollspy.js +++ b/bower_components/bootstrap/js/scrollspy.js @@ -1,5 +1,5 @@ /* ======================================================================== - * Bootstrap: scrollspy.js v3.2.0 + * Bootstrap: scrollspy.js v3.3.0 * http://getbootstrap.com/javascript/#scrollspy * ======================================================================== * Copyright 2011-2014 Twitter, Inc. @@ -30,7 +30,7 @@ this.process() } - ScrollSpy.VERSION = '3.2.0' + ScrollSpy.VERSION = '3.3.0' ScrollSpy.DEFAULTS = { offset: 10 @@ -91,8 +91,9 @@ 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--;) { @@ -106,9 +107,7 @@ 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 + '"],' + @@ -127,6 +126,12 @@ active.trigger('activate.bs.scrollspy') } + ScrollSpy.prototype.clear = function () { + $(this.selector) + .parentsUntil(this.options.target, '.active') + .removeClass('active') + } + // SCROLLSPY PLUGIN DEFINITION // =========================== |