My project has a sticky header after scrolling that uses this script:
$(document).ready(function() {
$(window).scroll(function () {
//if you hard code, then use console
//.log to determine when you want the
//nav bar to stick.
console.log($(window).scrollTop())
if ($(window).scrollTop() > 385) {
$('#nav').addClass('navbar-fixed');
}
if ($(window).scrollTop() < 386) {
$('#nav').removeClass('navbar-fixed');
}
});
});
How can I animate this so that it looks better?