2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-17 19:21:23 +03: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
+11 -7
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 = [];
+1 -1
View File
File diff suppressed because one or more lines are too long