mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-24 14:34:09 +00:00
spacing fixes
This commit is contained in:
parent
9875f6d759
commit
21b26a6509
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue