diff options
author | matus <matus@ventes.io> | 2016-01-09 11:40:51 +0300 |
---|---|---|
committer | Mark Otto <markdotto@gmail.com> | 2016-11-26 04:39:00 +0300 |
commit | d328c911cbc74e6958ee747ebf17a7481a32d831 (patch) | |
tree | 6fa6a544575d1233e7f487a9a24484e53ae31425 /js/dist/scrollspy.js | |
parent | 39d7861f34e01933ebee4f6b05e3ed24bca7f116 (diff) |
Added a virtual test
Diffstat (limited to 'js/dist/scrollspy.js')
-rw-r--r-- | js/dist/scrollspy.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/js/dist/scrollspy.js b/js/dist/scrollspy.js index 2fb9b5880a..2b48456653 100644 --- a/js/dist/scrollspy.js +++ b/js/dist/scrollspy.js @@ -182,10 +182,14 @@ var ScrollSpy = function ($) { return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); }; + ScrollSpy.prototype._getOffsetHeight = function _getOffsetHeight() { + return this._scrollElement === window ? window.innerHeight : this._scrollElement.offsetHeight; + }; + ScrollSpy.prototype._process = function _process() { var scrollTop = this._getScrollTop() + this._config.offset; var scrollHeight = this._getScrollHeight(); - var maxScroll = this._config.offset + scrollHeight - this._scrollElement.offsetHeight; + var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); if (this._scrollHeight !== scrollHeight) { this.refresh(); @@ -197,6 +201,7 @@ var ScrollSpy = function ($) { if (this._activeTarget !== target) { this._activate(target); } + return; } if (this._activeTarget && scrollTop < this._offsets[0]) { |