lundi 2 mars 2015

Javascript scroll and window resize


Vote count:

0




I have a div class named navbar that I want to fadein when the page is scrolled 700px down. However, when the page width is less than 600px, I do not want it to show. Any ideas?



$(window).addEventListener('onresize',function(){
$(window).scroll(function (e) {
e.preventDefault();
if ($(this).scrollTop() > 700 & window.innerWidth > 600) {
$('.navbar').fadeIn();
}
else {
$('.navbar').fadeOut();
}
});
});


asked 1 min ago







Javascript scroll and window resize

Aucun commentaire:

Enregistrer un commentaire