diff options
author | Jacob Thornton <jacobthornton@gmail.com> | 2012-03-20 02:18:00 +0400 |
---|---|---|
committer | Jacob Thornton <jacobthornton@gmail.com> | 2012-03-20 02:18:00 +0400 |
commit | 5a2c7eb50abae8d07cebb6b0e984f7e63843cf75 (patch) | |
tree | ce10bed5cf73666443189b0e0ad3aba72640bc4c /js/bootstrap-scrollspy.js | |
parent | 527fb87dadd1e677f132ca3db0b02825d5bd57e5 (diff) |
select last item in scrollspy if you've reached the bottom of the document or element
Diffstat (limited to 'js/bootstrap-scrollspy.js')
-rw-r--r-- | js/bootstrap-scrollspy.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/js/bootstrap-scrollspy.js b/js/bootstrap-scrollspy.js index ea29f2f866..47b4857853 100644 --- a/js/bootstrap-scrollspy.js +++ b/js/bootstrap-scrollspy.js @@ -57,11 +57,18 @@ , process: function () { var scrollTop = this.$scrollElement.scrollTop() + this.options.offset + , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight + , maxScroll = scrollHeight - this.$scrollElement.height() , offsets = this.offsets , targets = this.targets , activeTarget = this.activeTarget , i + if (scrollTop >= maxScroll) { + return activeTarget != (i = targets.last()[0]) + && this.activate ( i ); + } + for (i = offsets.length; i--;) { activeTarget != targets[i] && scrollTop >= offsets[i] |