// menu scroll
var lastScrollTop = 0;
var lastScrollChange = 0;
var scrollDown = true;
var topOffset = 100;
var lastScrollChangeOffset = 100;
$(window).scroll(function(event){
checkScroll();
});
checkScroll();
function checkScroll(){
var st = $(this).scrollTop();
if(st < lastScrollTop){
if(!scrollDown){
lastScrollChange = st;
scrollDown = true;
}
}else{
if(scrollDown){
lastScrollChange = st;
scrollDown = false;
}
}
if(st - lastScrollChange > lastScrollChangeOffset){
lastScrollChange = st;
if(!scrollDown){
$("body").addClass("down");
}else{
$("body").removeClass("down");
}
}
if(st > topOffset){
$("body").addClass("scroll");
}else{
$("body").removeClass("scroll");
}
lastScrollTop = st;
}