added scroll functionality for navbar: hide on scroll down, show on scroll up
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index 6243bc7..5b0e7d1 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -127,6 +127,19 @@
}
);
+ // Hide and show navbar on scroll
+ let prevScrollPos = window.scrollY;
+
+ window.onscroll = function() {
+ let currentScrollPos = window.scrollY;
+ if (prevScrollPos > currentScrollPos) {
+ document.querySelector('.navbar').style.top = '0';
+ } else {
+ document.querySelector('.navbar').style.top = '-3rem';
+ }
+ prevScrollPos = currentScrollPos;
+ }
+
/**
* Replace Virtual Corpus field
*/
diff --git a/dev/scss/header/header.scss b/dev/scss/header/header.scss
index b640531..04e318e 100644
--- a/dev/scss/header/header.scss
+++ b/dev/scss/header/header.scss
@@ -32,6 +32,10 @@
position: fixed;
top: 0;
z-index: 999;
+ transition: top .3s ease-in-out;
+ -o-transition: top .3s ease-in-out;
+ -moz-transition: top .3s ease-in-out;
+ -webkit-transition: top .3s ease-in-out;
&-group {