function ScrollSpy(element, options) {
var process = $.proxy(this.process, this)
- this.$element = $(element).is('body') ? $(window) : $(element)
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.selector = (this.options.target || '') + ' .nav li > a'
this.offsets = []
this.targets = []
this.activeTarget = null
+ this.$scrollElement.on('scroll.bs.scrollspy', process)
this.refresh()
this.process()
}
}
ScrollSpy.prototype.refresh = function () {
- var offsetMethod = this.$element[0] == window ? 'offset' : 'position'
+ var offsetMethod = this.$scrollElement[0] == window ? 'offset' : 'position'
this.offsets = []
this.targets = []