On my site, I have a fadeIn effect for my #header using jQuery. How can I disable the effect for mobile optimization? Below is the code used for the effect.
$(window).scroll(function () {
if ($(window).scrollTop() > 400) {
$("#header").fadeIn(200);
}
if ($(window).scrollTop() < 399) {
$("#header").fadeOut(200);
}
});
Try with:
// change 320 to required min width
if ( $(window).width() > 320 ) {
// your scroll code here
}