diff options
author | Annabel Dunstone Gray <annabel.dunstone@gmail.com> | 2017-04-24 09:52:53 -0500 |
---|---|---|
committer | Annabel Dunstone Gray <annabel.dunstone@gmail.com> | 2017-05-12 09:27:05 -0500 |
commit | 5e9625bf1b0da3bc7a88cdd0d2b33a0813190c98 (patch) | |
tree | b9900ff4c9f10c6c47dda8729b528ddd873486f2 /app/assets/javascripts/layout_nav.js | |
parent | cfea48832db7d716a1efc1499fbe5b50ece7ccac (diff) | |
download | gitlab-ce-5e9625bf1b0da3bc7a88cdd0d2b33a0813190c98.tar.gz |
Add nav border on scroll
Diffstat (limited to 'app/assets/javascripts/layout_nav.js')
-rw-r--r-- | app/assets/javascripts/layout_nav.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/assets/javascripts/layout_nav.js b/app/assets/javascripts/layout_nav.js index a5f99bcdd8f..341fc6fc3e4 100644 --- a/app/assets/javascripts/layout_nav.js +++ b/app/assets/javascripts/layout_nav.js @@ -1,4 +1,5 @@ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-arrow-callback, no-unused-vars, one-var, one-var-declaration-per-line, vars-on-top, max-len */ +import _ from 'underscore'; (function() { var hideEndFade; @@ -45,4 +46,14 @@ } }); }); + + function applyScrollNavClass() { + if ($(window).scrollTop() > 0) { + $('.navbar-gitlab').addClass('scroll'); + } else { + $('.navbar-gitlab').removeClass('scroll'); + } + } + + $(window).scroll( _.throttle(applyScrollNavClass, 250)); }).call(window); |