I am struggling with the following: I want to change the behaviour of my header, depending on the Screen width. It works just fine when going from small to big resolution. But the other way round the "ganzOben" and "inMitte" functions don't stop. Any Ideas?
$(document).load($(window).bind("resize", checkHeader));
$(document).ready(checkHeader ());
$(window).scroll(checkHeader ());
function checkHeader(){
if (window.matchMedia('(min-width: 725px)').matches) {
$(window).scroll(function ganzOben (){
if($(document).scrollTop() <= 0) {
/* CSS for Header Desktop Res TOP */
}
});
var lastScrollTop = 0;
$(window).scroll(function inMitte (event){
var st = $(this).scrollTop();
if (st > lastScrollTop){
/* CSS for Header invisble by Downscolling */
} else {
/* CSS for Header visible by Upscolling */
}
lastScrollTop = st;
});
} else {
$(window).scroll(function inMitte (event) {return false});
$(window).scroll(function ganzOben () {return false});
/* CSS for Header in mobile View */
};
};
`