Collapse navbar if page is not at top on load
This commit is contained in:
parent
772584e013
commit
ea67189c27
@ -26,13 +26,16 @@
|
||||
offset: 54
|
||||
});
|
||||
|
||||
// Collapse the navbar when page is scrolled
|
||||
$(window).scroll(function() {
|
||||
var navbarCollapse = function() {
|
||||
if ($("#mainNav").offset().top > 100) {
|
||||
$("#mainNav").addClass("navbar-shrink");
|
||||
} else {
|
||||
$("#mainNav").removeClass("navbar-shrink");
|
||||
}
|
||||
});
|
||||
};
|
||||
// Collapse now if page is not at top
|
||||
navbarCollapse();
|
||||
// Collapse the navbar when page is scrolled
|
||||
$(window).scroll(navbarCollapse);
|
||||
|
||||
})(jQuery); // End of use strict
|
||||
|
Loading…
Reference in New Issue
Block a user