nunta/js/agency.js

36 lines
1.0 KiB
JavaScript
Raw Normal View History

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