$(document).ready(function() {
    // Add active class to nav link
    var path = window.location.pathname.split("/").pop();
    if(path == '') path = 'index.php';
    
    $('.nav-link').each(function() {
        var href = $(this).attr('href');
        if (path === href) {
            $(this).addClass('active');
        }
    });

    // Smooth scrolling
    $('a[href^="#"]').on('click', function(event) {
        var target = $(this.getAttribute('href'));
        if( target.length ) {
            event.preventDefault();
            $('html, body').stop().animate({
                scrollTop: target.offset().top - 80
            }, 500);
        }
    });
});
