1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-13 17:14:04 +02:00
This commit is contained in:
fat
2015-05-13 12:55:11 -07:00
parent f8b2569ec8
commit da495ee24c
4 changed files with 112 additions and 15 deletions

18
js/dist/scrollspy.js vendored
View File

@@ -27,7 +27,8 @@ var ScrollSpy = (function ($) {
var JQUERY_NO_CONFLICT = $.fn[NAME];
var Default = {
offset: 10
offset: 10,
method: 'auto'
};
var Event = {
@@ -48,6 +49,11 @@ var ScrollSpy = (function ($) {
LI: 'li'
};
var OffsetMethod = {
OFFSET: 'offset',
POSITION: 'position'
};
/**
* ------------------------------------------------------------------------
* Class Definition
@@ -81,13 +87,11 @@ var ScrollSpy = (function ($) {
value: function refresh() {
var _this = this;
var offsetMethod = 'offset';
var offsetBase = 0;
var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET;
if (this._scrollElement !== this._scrollElement.window) {
offsetMethod = 'position';
offsetBase = this._getScrollTop();
}
var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
this._offsets = [];
this._targets = [];