2016-06-22 21:35:40 +02:00
|
|
|
(function($) {
|
|
|
|
"use strict"; // Start of use strict
|
|
|
|
|
2017-03-31 23:05:07 +02:00
|
|
|
// Smooth scrolling using jQuery Easing
|
|
|
|
$('a[href*="#"]:not([href="#"])').click(function() {
|
|
|
|
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
|
|
|
|
var target = $(this.hash);
|
|
|
|
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
|
|
|
|
if (target.length) {
|
|
|
|
$('html, body').animate({
|
|
|
|
scrollTop: (target.offset().top - 54)
|
|
|
|
}, 1000, "easeInOutExpo");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2014-08-13 03:01:38 +02:00
|
|
|
});
|
|
|
|
|
2017-03-31 23:05:07 +02:00
|
|
|
// Activate scrollspy to add active class to navbar items on scroll
|
2016-06-22 21:35:40 +02:00
|
|
|
$('body').scrollspy({
|
2016-11-30 03:03:56 +01:00
|
|
|
target: '#mainNav',
|
2017-01-21 02:24:00 +01:00
|
|
|
offset: 54
|
2016-06-22 21:35:40 +02:00
|
|
|
});
|
|
|
|
|
2017-03-31 23:05:07 +02:00
|
|
|
// Closes responsive menu when a link is clicked
|
2017-03-06 17:21:55 +01:00
|
|
|
$('.navbar-collapse>ul>li>a').click(function() {
|
|
|
|
$('.navbar-collapse').collapse('hide');
|
2016-06-22 21:35:40 +02:00
|
|
|
});
|
|
|
|
|
2017-03-31 23:05:07 +02:00
|
|
|
// Collapse the navbar when page is scrolled
|
2016-11-30 03:03:56 +01:00
|
|
|
$(window).scroll(function() {
|
|
|
|
if ($("#mainNav").offset().top > 100) {
|
|
|
|
$("#mainNav").addClass("navbar-shrink");
|
|
|
|
} else {
|
|
|
|
$("#mainNav").removeClass("navbar-shrink");
|
2016-06-22 21:35:40 +02:00
|
|
|
}
|
2016-11-30 03:03:56 +01:00
|
|
|
});
|
2014-08-13 03:01:38 +02:00
|
|
|
|
2016-06-22 21:35:40 +02:00
|
|
|
})(jQuery); // End of use strict
|