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
|
offset: 54
|
||||||
});
|
});
|
||||||
|
|
||||||
// Collapse the navbar when page is scrolled
|
var navbarCollapse = function() {
|
||||||
$(window).scroll(function() {
|
|
||||||
if ($("#mainNav").offset().top > 100) {
|
if ($("#mainNav").offset().top > 100) {
|
||||||
$("#mainNav").addClass("navbar-shrink");
|
$("#mainNav").addClass("navbar-shrink");
|
||||||
} else {
|
} else {
|
||||||
$("#mainNav").removeClass("navbar-shrink");
|
$("#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
|
})(jQuery); // End of use strict
|
||||||
|
Loading…
Reference in New Issue
Block a user