diff --git a/js/agency.js b/js/agency.js index 75475e3..52e8c05 100644 --- a/js/agency.js +++ b/js/agency.js @@ -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