diff options
author | Phil Hughes <me@iamphill.com> | 2017-07-28 11:54:51 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-08-03 17:03:49 +0100 |
commit | 30777178e3311c8aa7f4ecae82bd970fda63d85c (patch) | |
tree | 27fd276d1c9ccdd6ba5ec3928352f9d092fb487d /app/assets/javascripts/lib | |
parent | b507682d6e799f737c05f27201dc4a0dbe3aba1d (diff) | |
download | gitlab-ce-30777178e3311c8aa7f4ecae82bd970fda63d85c.tar.gz |
fixed jumping when bar gets stuck
added specs to sticky util file
added `No files found.` text when results are empty
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r-- | app/assets/javascripts/lib/utils/sticky.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/assets/javascripts/lib/utils/sticky.js b/app/assets/javascripts/lib/utils/sticky.js index f53acaa17b1..b5fde040a17 100644 --- a/app/assets/javascripts/lib/utils/sticky.js +++ b/app/assets/javascripts/lib/utils/sticky.js @@ -1,5 +1,5 @@ -export const isSticky = (el, stickyTop) => { - const top = el.getBoundingClientRect().top; +export const isSticky = (el, scrollY, stickyTop) => { + const top = el.offsetTop - scrollY; if (top === stickyTop) { el.classList.add('is-stuck'); @@ -15,7 +15,7 @@ export default (el) => { const stickyTop = parseInt(computedStyle.top, 10); - document.addEventListener('scroll', () => isSticky(el, stickyTop), { + document.addEventListener('scroll', () => isSticky(el, window.scrollY, stickyTop), { passive: true, }); }; |