Skip to content

Instantly share code, notes, and snippets.

@clamarque
Created October 11, 2016 08:37
Show Gist options
  • Save clamarque/f1d6c71f06606f9724d4e2d2b446a12c to your computer and use it in GitHub Desktop.
Save clamarque/f1d6c71f06606f9724d4e2d2b446a12c to your computer and use it in GitHub Desktop.
JS - Adding navbar to Scroll CSS
$(document).ready(function () {
$(window).scroll(function () {
var y = $(window).scrollTop();
if (y > 400) {
$('.navbar').fadeIn(300);
$(".navbar").css({
'background-color': '#305162'
});
$(".navbar-nav>li>a").click(function () {
$(".navbar-nav>li>a").each(function () {
$(this).removeClass('.nav__current');
});
$(this).addClass('.nav__current');
});
$('#navbar').animate({
'height': '60'
}, {
duration: 200,
queue: false
});
} else {
$('.navbar').fadeOut(300);
$(".navbar").css({
'background-color': 'transparent',
'border-bottom': 'none'
});
$('#navbar').animate({
'height': '51'
}, {
duration: 200,
queue: false
});
}
/*
if ($(window).width() > 767) {
$('.scrollpoint.sp-effect3').waypoint(function(){$(this).toggleClass('active');$(this).toggleClass('animated fadeInDown');},{offset:'90%'});
if ($(this).scrollTop() > 600) {
$('.scroll-up').fadeIn(300);
} else {
$('.scroll-up').fadeOut(300);
}
}
if($(window).width() > 767) {
}*/
/*
$('#result').html(y);
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment