!(function($) { "use strict"; // Toggle .header-scrolled class to #header when page is scrolled $(window).scroll(function() { if ($(this).scrollTop() > 100) { $('#header').addClass('header-scrolled'); } else { $('#header').removeClass('header-scrolled'); } }); if ($(window).scrollTop() > 100) { $('#header').addClass('header-scrolled'); } // Smooth scroll for the navigation menu and links with .scrollto classes $(document).on('click', '.nav-menu a, .mobile-nav a, .scrollto', function(e) { if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { e.preventDefault(); var target = $(this.hash); if (target.length) { var scrollto = target.offset().top; var scrolled = 20; if ($('#header').length) { scrollto -= $('#header').outerHeight() if (!$('#header').hasClass('header-scrolled')) { scrollto += scrolled; } } if ($(this).attr("href") == '#header') { scrollto = 0; } $('html, body').animate({ scrollTop: scrollto }, 1500, 'easeInOutExpo'); if ($(this).parents('.nav-menu, .mobile-nav').length) { $('.nav-menu .active, .mobile-nav .active').removeClass('active'); $(this).closest('li').addClass('active'); } if ($('body').hasClass('mobile-nav-active')) { $('body').removeClass('mobile-nav-active'); $('.mobile-nav-toggle i').toggleClass(''); $('.mobile-nav-overly').fadeOut(); } return false; } } }); /* For Mobile navigation */ $(".mobNav, .close-btn").on('click',function() { $('.headerMenu').toggleClass('active'); $(this).find('i').toggleClass('fa-times'); }); $(".mobNav-footer, .close-btn2").on('click',function() { $('.headerMenu-footer').toggleClass('active'); $(this).find('i').toggleClass('fa-times'); }); })(jQuery);