diff --git a/js/scrollspy.js b/js/scrollspy.js index 74e016dc9f..53e1c48baa 100644 --- a/js/scrollspy.js +++ b/js/scrollspy.js @@ -69,7 +69,7 @@ ScrollSpy.prototype.process = function () { var scrollTop = this.$scrollElement.scrollTop() + this.options.offset var scrollHeight = this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) - var maxScroll = scrollHeight - this.$scrollElement.height() + var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height() var offsets = this.offsets var targets = this.targets var activeTarget = this.activeTarget diff --git a/js/tests/unit/scrollspy.js b/js/tests/unit/scrollspy.js index 90c95d7691..9a00221fd8 100644 --- a/js/tests/unit/scrollspy.js +++ b/js/tests/unit/scrollspy.js @@ -42,7 +42,8 @@ $(function () { ok($topbar.find('.active', true)) }) - test('should only switch active class on current target', function () { + asyncTest('should only switch active class on current target', function () { + expect(1); var sectionHTML = '