diff options
author | Mike Greiling <mike@pixelcog.com> | 2016-11-11 02:24:57 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2016-12-03 02:38:58 +0300 |
commit | 54a794f2dfe88cdaa0dcc5c43f17fbc966082035 (patch) | |
tree | fdf6206f9ed52af07e8291a0362857f0c09d69eb /app | |
parent | c434568f3759dfcdb8f9c55a11aa037a760ec7d2 (diff) |
adjust scrollToElement to account for fixed merge request tabs
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/merge_request_tabs.js.es6 | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/assets/javascripts/merge_request_tabs.js.es6 b/app/assets/javascripts/merge_request_tabs.js.es6 index 1a3df1bed36..10a2f8091b8 100644 --- a/app/assets/javascripts/merge_request_tabs.js.es6 +++ b/app/assets/javascripts/merge_request_tabs.js.es6 @@ -135,12 +135,14 @@ scrollToElement(container) { if (location.hash) { - const navBarHeight = $('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight() + document.querySelector('.js-tabs-affix').offsetHeight; + const offset = 0 - ( + $('.navbar-gitlab').outerHeight() + + $('.layout-nav').outerHeight() + + $('.js-tabs-affix').outerHeight() + ); const $el = $(`${container} ${location.hash}:not(.match)`); - if ($el.length) { - $.scrollTo($el[0], { - offset: -navBarHeight, - }); + if ($el.length > 0) { + $.scrollTo($el[0], { offset }); } } } |