I applied the following function to hide the header when the user scrolls downs, and show it again when they scroll up:
var previousScroll = 0,
headerOrgOffset = $('#header').height();
$('#header-wrap').height($('#header').height());
$(window).scroll(function () {
var currentScroll = $(this).scrollTop();
if ($(this).width() < 768) {
if (currentScroll > headerOrgOffset) {
if (currentScroll > previousScroll) {
$('#header-wrap').slideUp();
} else {
$('#header-wrap').slideDown();
}
}
}
previousScroll = currentScroll;
});
It works like a charm, but I wanted to apply an easing effect, since the animation is rough, but I failed to succeed so far.
Thank you in advance for you help.
P.s. Sorry, but I forgot to mention that my jquery knowledge is very limited.
EDIT:
I decided go with a different function, but even though it works fine on codepen (http://codepen.io/anon/pen/bNOgeb), on jsfiddle doesn't (https://jsfiddle.net/8bdhzzLb/) and I suppose it's because the Jquery libray is automatically loaded on CodePen, but not in JSfiddle.
I've tried to include the src you provided, but for some reason it doesn't work.
Thanks.