diff options
author | Phil Hughes <me@iamphill.com> | 2017-07-28 12:11:05 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-08-03 17:03:49 +0100 |
commit | d86cbe69410a9a20bdeb996435a134c71ee87863 (patch) | |
tree | 13c30b051a387fabbd4563f2af86e5a48d41b6ed /app/assets/javascripts | |
parent | 30777178e3311c8aa7f4ecae82bd970fda63d85c (diff) | |
download | gitlab-ce-d86cbe69410a9a20bdeb996435a134c71ee87863.tar.gz |
fixed alignment in button
correctly scroll to element with sticky height offset
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/lib/utils/common_utils.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js index 122ec138c59..e916724b666 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js +++ b/app/assets/javascripts/lib/utils/common_utils.js @@ -86,8 +86,9 @@ // This is required to handle non-unicode characters in hash hash = decodeURIComponent(hash); - var fixedTabs = document.querySelector('.js-tabs-affix'); - var fixedNav = document.querySelector('.navbar-gitlab'); + const fixedTabs = document.querySelector('.js-tabs-affix'); + const fixedDiffStats = document.querySelector('.js-diff-files-changed.is-stuck'); + const fixedNav = document.querySelector('.navbar-gitlab'); var adjustment = 0; if (fixedNav) adjustment -= fixedNav.offsetHeight; @@ -104,6 +105,11 @@ if (fixedTabs) { adjustment -= fixedTabs.offsetHeight; } + + if (fixedDiffStats) { + adjustment -= fixedDiffStats.offsetHeight; + } + window.scrollBy(0, adjustment); } }; |