mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-29 21:52:22 +01:00
removing this.$element as it is a superfluous copy of this.$scrollElement
This commit is contained in:
parent
632313d631
commit
bc8e6ffb7d
@ -16,15 +16,15 @@
|
|||||||
function ScrollSpy(element, options) {
|
function ScrollSpy(element, options) {
|
||||||
var process = $.proxy(this.process, this)
|
var process = $.proxy(this.process, this)
|
||||||
|
|
||||||
this.$element = $(element).is('body') ? $(window) : $(element)
|
|
||||||
this.$body = $('body')
|
this.$body = $('body')
|
||||||
this.$scrollElement = this.$element.on('scroll.bs.scrollspy', process)
|
this.$scrollElement = $(element).is('body') ? $(window) : $(element)
|
||||||
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
|
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
|
||||||
this.selector = (this.options.target || '') + ' .nav li > a'
|
this.selector = (this.options.target || '') + ' .nav li > a'
|
||||||
this.offsets = []
|
this.offsets = []
|
||||||
this.targets = []
|
this.targets = []
|
||||||
this.activeTarget = null
|
this.activeTarget = null
|
||||||
|
|
||||||
|
this.$scrollElement.on('scroll.bs.scrollspy', process)
|
||||||
this.refresh()
|
this.refresh()
|
||||||
this.process()
|
this.process()
|
||||||
}
|
}
|
||||||
@ -36,7 +36,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
ScrollSpy.prototype.refresh = function () {
|
ScrollSpy.prototype.refresh = function () {
|
||||||
var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
|
var offsetMethod = this.$scrollElement[0] == window ? 'offset' : 'position'
|
||||||
|
|
||||||
this.offsets = []
|
this.offsets = []
|
||||||
this.targets = []
|
this.targets = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user