grav-theme-libretic/js/fixed-header.js

16 lines
385 B
JavaScript
Raw Normal View History

$(document).ready(function() {
var navbar = $('#navbar');
var navbarOffset = navbar.offset().top;
$(window).scroll(function(){
var scroll = $(window).scrollTop();
if (scroll >= navbarOffset) {
navbar.height(navbar.height());
navbar.addClass('fixed');
} else {
navbar.removeClass('fixed');
}
});
});