我正在努力解决以下问题:我想根据屏幕宽度更改标题的行为。从小分辨率到大分辨率时它工作得很好。但反过来说,“ganzOben”和“inMitte”功能并没有停止。有任何想法吗?
$(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 */
};
};
`