aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Greiling <[email protected]>2014-05-29 02:24:41 -0500
committerChris Rebert <[email protected]>2014-06-07 18:09:53 -0700
commit0be41096888201831c151864c0ab05cf0b5ca734 (patch)
treed6e21a8e9c804b0e8e00f41d385217aafaaaaabe
parent2ca6581798cf516d6ab2029bf63d1ed5f1070703 (diff)
downloadbootstrap-0be41096888201831c151864c0ab05cf0b5ca734.tar.xz
bootstrap-0be41096888201831c151864c0ab05cf0b5ca734.zip
there is no need for this.offsets and this.targets to be jQuery objects
-rw-r--r--js/scrollspy.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/js/scrollspy.js b/js/scrollspy.js
index cddde45ad..de4f98707 100644
--- a/js/scrollspy.js
+++ b/js/scrollspy.js
@@ -24,8 +24,8 @@
this.selector = (this.options.target
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|| '') + ' .nav li > a'
- this.offsets = $([])
- this.targets = $([])
+ this.offsets = []
+ this.targets = []
this.activeTarget = null
this.refresh()
@@ -41,8 +41,9 @@
ScrollSpy.prototype.refresh = function () {
var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
- this.offsets = $([])
- this.targets = $([])
+ this.offsets = []
+ this.targets = []
+
var self = this
this.$body
@@ -75,7 +76,7 @@
var i
if (scrollTop >= maxScroll) {
- return activeTarget != (i = targets.last()[0]) && this.activate(i)
+ return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
}
if (activeTarget && scrollTop <= offsets[0]) {