diff options
author | matus <matus@ventes.io> | 2016-01-08 22:20:40 +0300 |
---|---|---|
committer | Mark Otto <markdotto@gmail.com> | 2016-11-26 04:38:42 +0300 |
commit | 39d7861f34e01933ebee4f6b05e3ed24bca7f116 (patch) | |
tree | 5fb5a038c9db8f737c3609ef66185dea23979a35 /js/src/scrollspy.js | |
parent | 8a7ce25cf19e405f689b0b7938e14d51acc2b9b4 (diff) |
Scrollspy selecting the last element when at the bottom of the page (fixes #17739)
Diffstat (limited to 'js/src/scrollspy.js')
-rw-r--r-- | js/src/scrollspy.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/js/src/scrollspy.js b/js/src/scrollspy.js index 98582f9182..9b39acd362 100644 --- a/js/src/scrollspy.js +++ b/js/src/scrollspy.js @@ -196,12 +196,17 @@ const ScrollSpy = (($) => { ) } + _getOffsetHeight() { + return this._scrollElement === window ? + window.innerHeight : this._scrollElement.offsetHeight + } + _process() { const scrollTop = this._getScrollTop() + this._config.offset const scrollHeight = this._getScrollHeight() const maxScroll = this._config.offset + scrollHeight - - this._scrollElement.offsetHeight + - this._getOffsetHeight() if (this._scrollHeight !== scrollHeight) { this.refresh() @@ -213,6 +218,7 @@ const ScrollSpy = (($) => { if (this._activeTarget !== target) { this._activate(target) } + return } if (this._activeTarget && scrollTop < this._offsets[0]) { |