From 21b26a6509d83b78d32db0e9c7d9435f787af09c Mon Sep 17 00:00:00 2001 From: alistair3149 Date: Tue, 8 Oct 2019 15:22:02 -0400 Subject: [PATCH] spacing fixes --- resources/scripts/header.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/resources/scripts/header.js b/resources/scripts/header.js index 8a1b2ffb..c6cc6014 100644 --- a/resources/scripts/header.js +++ b/resources/scripts/header.js @@ -1,8 +1,8 @@ /* -* Scroll up Header -* Modified from https://codepen.io/sajjad/pen/vgEZNy -* TODO: Convert to Vanilla JS -*/ + * Scroll up Header + * Modified from https://codepen.io/sajjad/pen/vgEZNy + * TODO: Convert to Vanilla JS + */ // Hide header on scroll down var didScroll; @@ -10,7 +10,7 @@ var lastScrollTop = 0; var delta = 0; var navbarHeight = $('.mw-header-container').outerHeight(); -$(window).scroll(function(event){ +$(window).scroll(function(event) { didScroll = true; }); @@ -25,22 +25,22 @@ function hasScrolled() { var st = $(this).scrollTop(); // Make scroll more than delta - if(Math.abs(lastScrollTop - st) <= delta) + if (Math.abs(lastScrollTop - st) <= delta) return; // If scrolled down and past the navbar, add class .nav-up. - if (st > lastScrollTop && st > navbarHeight){ + if (st > lastScrollTop && st > navbarHeight) { // Scroll Down $('header').removeClass('nav-down').addClass('nav-up'); - } else if (document.scrollTop == 0){ - // Remove class when header is back in place - $('header').removeClass('nav-down') + } else if (document.scrollTop == 0) { + // Remove class when header is back in place + $('header').removeClass('nav-down') } else { - // Scroll Up - if(st + $(window).height() < $(document).height()) { - $('header').removeClass('nav-up').addClass('nav-down'); - } + // Scroll Up + if (st + $(window).height() < $(document).height()) { + $('header').removeClass('nav-up').addClass('nav-down'); + } } lastScrollTop = st; -} +} \ No newline at end of file