diff --git a/index.html b/index.html index 4bd428f..5dcb245 100644 --- a/index.html +++ b/index.html @@ -367,6 +367,7 @@
Aligarh
+ diff --git a/index.js b/index.js new file mode 100644 index 0000000..c3ed1f8 --- /dev/null +++ b/index.js @@ -0,0 +1,16 @@ +let lastScrollTop = 0; +const navbar = document.querySelector('.navbar'); + +window.addEventListener('scroll', function() { + let scrollTop = window.pageYOffset || document.documentElement.scrollTop; + + if (scrollTop > lastScrollTop) { + // Scrolling down + navbar.style.top = '-80px'; // Adjust height accordingly + } else { + // Scrolling up + navbar.style.top = '0'; + } + + lastScrollTop = scrollTop; +});