diff options
| author | Bootstrap's Grunt bot <[email protected]> | 2015-02-25 01:11:20 +0000 |
|---|---|---|
| committer | Bootstrap's Grunt bot <[email protected]> | 2015-02-25 01:11:20 +0000 |
| commit | 1d892ceef106d5a296da9be9ae6382297a427bb9 (patch) | |
| tree | c8b553ac9ed99b84ea9927c37cf070a52fa48f6d /dist/js/bootstrap.js | |
| parent | 9ea98561dffd58b1f59b2687b3d09445b63ff756 (diff) | |
| download | bootstrap-1d892ceef106d5a296da9be9ae6382297a427bb9.tar.xz bootstrap-1d892ceef106d5a296da9be9ae6382297a427bb9.zip | |
automatic grunt dist
Diffstat (limited to 'dist/js/bootstrap.js')
| -rw-r--r-- | dist/js/bootstrap.js | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index 5a11cc20d..c19a68870 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -1837,10 +1837,8 @@ if (typeof jQuery === 'undefined') { // ========================== function ScrollSpy(element, options) { - var process = $.proxy(this.process, this) - - this.$body = $('body') - this.$scrollElement = $(element).is('body') ? $(window) : $(element) + this.$body = $(document.body) + this.$scrollElement = $(element).is(document.body) ? $(window) : $(element) this.options = $.extend({}, ScrollSpy.DEFAULTS, options) this.selector = (this.options.target || '') + ' .nav li > a' this.offsets = [] @@ -1848,7 +1846,7 @@ if (typeof jQuery === 'undefined') { this.activeTarget = null this.scrollHeight = 0 - this.$scrollElement.on('scroll.bs.scrollspy', process) + this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this)) this.refresh() this.process() } @@ -1864,20 +1862,19 @@ if (typeof jQuery === 'undefined') { } ScrollSpy.prototype.refresh = function () { - var offsetMethod = 'offset' - var offsetBase = 0 + var that = this + var offsetMethod = 'offset' + var offsetBase = 0 + + this.offsets = [] + this.targets = [] + this.scrollHeight = this.getScrollHeight() if (!$.isWindow(this.$scrollElement[0])) { offsetMethod = 'position' offsetBase = this.$scrollElement.scrollTop() } - this.offsets = [] - this.targets = [] - this.scrollHeight = this.getScrollHeight() - - var self = this - this.$body .find(this.selector) .map(function () { @@ -1892,8 +1889,8 @@ if (typeof jQuery === 'undefined') { }) .sort(function (a, b) { return a[0] - b[0] }) .each(function () { - self.offsets.push(this[0]) - self.targets.push(this[1]) + that.offsets.push(this[0]) + that.targets.push(this[1]) }) } @@ -1933,8 +1930,8 @@ if (typeof jQuery === 'undefined') { this.clear() var selector = this.selector + - '[data-target="' + target + '"],' + - this.selector + '[href="' + target + '"]' + '[data-target="' + target + '"],' + + this.selector + '[href="' + target + '"]' var active = $(selector) .parents('li') |
