diff options
author | Mark Otto <markdotto@gmail.com> | 2017-03-19 04:47:57 +0300 |
---|---|---|
committer | Mark Otto <markdotto@gmail.com> | 2017-03-19 04:47:57 +0300 |
commit | ae50bb784506b4aa6b79598c2000c1d20843b5fd (patch) | |
tree | 057988a85f8af88723ef9acd4eb94292740168ed /js/dist/scrollspy.js | |
parent | 275821bbb081890ffe232d50d4778eb15bdb1d7b (diff) |
grunt
Diffstat (limited to 'js/dist/scrollspy.js')
-rw-r--r-- | js/dist/scrollspy.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/js/dist/scrollspy.js b/js/dist/scrollspy.js index 52cf3de3b4..10fc3c394a 100644 --- a/js/dist/scrollspy.js +++ b/js/dist/scrollspy.js @@ -126,9 +126,12 @@ var ScrollSpy = function ($) { target = $(targetSelector)[0]; } - if (target && (target.offsetWidth || target.offsetHeight)) { - // todo (fat): remove sketch reliance on jQuery position/offset - return [$(target)[offsetMethod]().top + offsetBase, targetSelector]; + if (target) { + var targetBCR = target.getBoundingClientRect(); + if (targetBCR.width || targetBCR.height) { + // todo (fat): remove sketch reliance on jQuery position/offset + return [$(target)[offsetMethod]().top + offsetBase, targetSelector]; + } } return null; }).filter(function (item) { @@ -183,7 +186,7 @@ var ScrollSpy = function ($) { }; ScrollSpy.prototype._getOffsetHeight = function _getOffsetHeight() { - return this._scrollElement === window ? window.innerHeight : this._scrollElement.offsetHeight; + return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; }; ScrollSpy.prototype._process = function _process() { |