Merge pull request #116 from brouillon/brouillon-patch-1
Collapse navbar if page is not at top on load
This commit is contained in:
commit
03818fa17a
@ -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
|
||||||
|
2
js/agency.min.js
vendored
2
js/agency.min.js
vendored
@ -3,4 +3,4 @@
|
|||||||
* Copyright 2013-2017 Start Bootstrap
|
* Copyright 2013-2017 Start Bootstrap
|
||||||
* Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap-agency/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap-agency/blob/master/LICENSE)
|
||||||
*/
|
*/
|
||||||
!function(a){"use strict";a('a.js-scroll-trigger[href*="#"]:not([href="#"])').click(function(){if(location.pathname.replace(/^\//,"")==this.pathname.replace(/^\//,"")&&location.hostname==this.hostname){var e=a(this.hash);if((e=e.length?e:a("[name="+this.hash.slice(1)+"]")).length)return a("html, body").animate({scrollTop:e.offset().top-54},1e3,"easeInOutExpo"),!1}}),a(".js-scroll-trigger").click(function(){a(".navbar-collapse").collapse("hide")}),a("body").scrollspy({target:"#mainNav",offset:54}),a(window).scroll(function(){a("#mainNav").offset().top>100?a("#mainNav").addClass("navbar-shrink"):a("#mainNav").removeClass("navbar-shrink")})}(jQuery);
|
(function(b){b('a.js-scroll-trigger[href*="#"]:not([href="#"])').click(function(){if(location.pathname.replace(/^\//,"")==this.pathname.replace(/^\//,"")&&location.hostname==this.hostname){var c=b(this.hash);c=c.length?c:b("[name="+this.hash.slice(1)+"]");if(c.length){b("html, body").animate({scrollTop:(c.offset().top-54)},1000,"easeInOutExpo");return false}}});b(".js-scroll-trigger").click(function(){b(".navbar-collapse").collapse("hide")});b("body").scrollspy({target:"#mainNav",offset:54});var a=function(){if(b("#mainNav").offset().top>100){b("#mainNav").addClass("navbar-shrink")}else{b("#mainNav").removeClass("navbar-shrink")}};a();b(window).scroll(a)})(jQuery);
|
||||||
|
Loading…
Reference in New Issue
Block a user