diff options
author | Mike Greiling <mike@pixelcog.com> | 2016-11-10 17:24:57 -0600 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2016-12-02 17:38:58 -0600 |
commit | 54a794f2dfe88cdaa0dcc5c43f17fbc966082035 (patch) | |
tree | fdf6206f9ed52af07e8291a0362857f0c09d69eb /app/assets | |
parent | c434568f3759dfcdb8f9c55a11aa037a760ec7d2 (diff) | |
download | gitlab-ce-54a794f2dfe88cdaa0dcc5c43f17fbc966082035.tar.gz |
adjust scrollToElement to account for fixed merge request tabs
Diffstat (limited to 'app/assets')
-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 }); } } } |