Is there a way to slide and fade at the same time?
Probably you should use .animate()
. Here is the reference. In your case it should look something like this:
function hideMenu(){
$('header.HoofdNav').stop().animate({
opacity: 0,
width: 0
});
}
function showMenu(){
$('header.HoofdNav').stop().animate({
opacity: 1,
width: '100%'
});
}
How to hide the menu during scroll and showing when you stop
scrolling? (maybe a tutorial or something)
To track scrolling you can use .scroll()
. Check it here. It triggers multiple times during scrolling, so I would recommend to make a timeout for e.g. 1 second to show the menu. Here is an example:
var timeout = false, afterScrollingWait = 1000; // here 1000 is time in milliseconds, play with it to make it the best for your app
$(document).scroll(function(){
hideMenu();
if (timeout) clearTimeout(timeout);
setTimeout(showMenu, afterScrollingWait);
});