Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-07-28 13:54:51 +0300
committerPhil Hughes <me@iamphill.com>2017-08-03 19:03:49 +0300
commit30777178e3311c8aa7f4ecae82bd970fda63d85c (patch)
tree27fd276d1c9ccdd6ba5ec3928352f9d092fb487d /app/assets/javascripts/lib/utils
parentb507682d6e799f737c05f27201dc4a0dbe3aba1d (diff)
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/utils')
-rw-r--r--app/assets/javascripts/lib/utils/sticky.js6
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,
});
};