Commit 0be41096 authored by Mike Greiling's avatar Mike Greiling Committed by Chris Rebert

there is no need for this.offsets and this.targets to be jQuery objects

parent 2ca65817
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
this.selector = (this.options.target this.selector = (this.options.target
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|| '') + ' .nav li > a' || '') + ' .nav li > a'
this.offsets = $([]) this.offsets = []
this.targets = $([]) this.targets = []
this.activeTarget = null this.activeTarget = null
this.refresh() this.refresh()
...@@ -41,8 +41,9 @@ ...@@ -41,8 +41,9 @@
ScrollSpy.prototype.refresh = function () { ScrollSpy.prototype.refresh = function () {
var offsetMethod = this.$element[0] == window ? 'offset' : 'position' var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
this.offsets = $([]) this.offsets = []
this.targets = $([]) this.targets = []
var self = this var self = this
this.$body this.$body
...@@ -75,7 +76,7 @@ ...@@ -75,7 +76,7 @@
var i var i
if (scrollTop >= maxScroll) { 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]) { if (activeTarget && scrollTop <= offsets[0]) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment