36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
// Agency Theme JavaScript
|
|
|
|
(function($) {
|
|
"use strict"; // Start of use strict
|
|
|
|
// jQuery for page scrolling feature - requires jQuery Easing plugin
|
|
$(document).on('click', 'a.page-scroll', function(event) {
|
|
var $anchor = $(this);
|
|
$('html, body').stop().animate({
|
|
scrollTop: ($($anchor.attr('href')).offset().top - 54)
|
|
}, 1250, 'easeInOutExpo');
|
|
event.preventDefault();
|
|
});
|
|
|
|
// Highlight the top nav as scrolling occurs
|
|
$('body').scrollspy({
|
|
target: '#mainNav',
|
|
offset: 54
|
|
});
|
|
|
|
// Closes the Responsive Menu on Menu Item Click
|
|
$('.navbar-collapse>ul>li>a').click(function() {
|
|
$('.navbar-collapse').collapse('hide');
|
|
});
|
|
|
|
// jQuery to collapse the navbar on scroll
|
|
$(window).scroll(function() {
|
|
if ($("#mainNav").offset().top > 100) {
|
|
$("#mainNav").addClass("navbar-shrink");
|
|
} else {
|
|
$("#mainNav").removeClass("navbar-shrink");
|
|
}
|
|
});
|
|
|
|
})(jQuery); // End of use strict
|