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
|
* Scroll up Header
|
||||||
* Modified from https://codepen.io/sajjad/pen/vgEZNy
|
* Modified from https://codepen.io/sajjad/pen/vgEZNy
|
||||||
* TODO: Convert to Vanilla JS
|
* TODO: Convert to Vanilla JS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Hide header on scroll down
|
// Hide header on scroll down
|
||||||
var didScroll;
|
var didScroll;
|
||||||
|
@ -10,7 +10,7 @@ var lastScrollTop = 0;
|
||||||
var delta = 0;
|
var delta = 0;
|
||||||
var navbarHeight = $('.mw-header-container').outerHeight();
|
var navbarHeight = $('.mw-header-container').outerHeight();
|
||||||
|
|
||||||
$(window).scroll(function(event){
|
$(window).scroll(function(event) {
|
||||||
didScroll = true;
|
didScroll = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -25,22 +25,22 @@ function hasScrolled() {
|
||||||
var st = $(this).scrollTop();
|
var st = $(this).scrollTop();
|
||||||
|
|
||||||
// Make scroll more than delta
|
// Make scroll more than delta
|
||||||
if(Math.abs(lastScrollTop - st) <= delta)
|
if (Math.abs(lastScrollTop - st) <= delta)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If scrolled down and past the navbar, add class .nav-up.
|
// If scrolled down and past the navbar, add class .nav-up.
|
||||||
if (st > lastScrollTop && st > navbarHeight){
|
if (st > lastScrollTop && st > navbarHeight) {
|
||||||
// Scroll Down
|
// Scroll Down
|
||||||
$('header').removeClass('nav-down').addClass('nav-up');
|
$('header').removeClass('nav-down').addClass('nav-up');
|
||||||
} else if (document.scrollTop == 0){
|
} else if (document.scrollTop == 0) {
|
||||||
// Remove class when header is back in place
|
// Remove class when header is back in place
|
||||||
$('header').removeClass('nav-down')
|
$('header').removeClass('nav-down')
|
||||||
} else {
|
} else {
|
||||||
// Scroll Up
|
// Scroll Up
|
||||||
if(st + $(window).height() < $(document).height()) {
|
if (st + $(window).height() < $(document).height()) {
|
||||||
$('header').removeClass('nav-up').addClass('nav-down');
|
$('header').removeClass('nav-up').addClass('nav-down');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastScrollTop = st;
|
lastScrollTop = st;
|
||||||
}
|
}
|
Loading…
Reference in a new issue