(function ($) { "use strict"; /*============================================= = Preloader = =============================================*/ function preloader() { $('#preloader').delay(0).fadeOut(); }; $(window).on('load', function () { preloader(); wowAnimation(); }); /*=========================================== = One page Menu = =============================================*/ $('.navigation a[href*="#"]:not([href="#"])').on("click", function() { console.log("click"); 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) { if ($(window).width() < 768) { $("html, body").animate({ scrollTop: target.offset().top - 80 }, 1000, "easeInOutExpo"); } else { $("html, body").animate({ scrollTop: target.offset().top - 80 }, 1000, "easeInOutExpo"); } return false; } } }); /*============================================= = Mobile Menu = =============================================*/ //SubMenu Dropdown Toggle if ($('.menu-area li.menu-item-has-children ul').length) { $('.menu-area .navigation li.menu-item-has-children').append(''); } //Mobile Nav Hide Show if ($('.mobile-menu').length) { var mobileMenuContent = $('.menu-area .main-menu').html(); $('.mobile-menu .menu-box .menu-outer').append(mobileMenuContent); //Dropdown Button $('.mobile-menu li.menu-item-has-children .dropdown-btn').on('click', function () { $(this).toggleClass('open'); $(this).prev('ul').slideToggle(300); }); //Menu Toggle Btn $('.mobile-nav-toggler').on('click', function () { $('body').addClass('mobile-menu-visible'); }); //Menu Toggle Btn $('.menu-backdrop, .mobile-menu .close-btn, .mobile-menu .navigation li a').on('click', function () { $('body').removeClass('mobile-menu-visible'); }); } /*============================================= = Menu sticky & Scroll to top = =============================================*/ $(window).on('scroll', function () { var scroll = $(window).scrollTop(); if (scroll < 245) { $("#sticky-header").removeClass("sticky-menu"); $('.scroll-to-target').removeClass('open'); $("#header-top-fixed").removeClass("header-fixed-position"); $("#header-fixed-height").removeClass("active-height"); } else { $("#sticky-header").addClass("sticky-menu"); $('.scroll-to-target').addClass('open'); $("#header-top-fixed").addClass("header-fixed-position"); $("#header-fixed-height").addClass("active-height"); } }); /*============================================= = Scroll Up = =============================================*/ if ($('.scroll-to-target').length) { $(".scroll-to-target").on('click', function () { var target = $(this).attr('data-target'); // animate $('html, body').animate({ scrollTop: $(target).offset().top }, 1000); }); } /*============================================= = Data Background = =============================================*/ $("[data-background]").each(function () { $(this).css("background-image", "url(" + $(this).attr("data-background") + ")") }) /*============================================= = Offcanvas Menu = =============================================*/ $(".menu-tigger").on("click", function () { $(".extra-info,.offcanvas-overly").addClass("active"); return false; }); $(".menu-close,.offcanvas-overly").on("click", function () { $(".extra-info,.offcanvas-overly").removeClass("active"); }); /*============================================= = Faq Active = =============================================*/ $(".accordion-header").on('click', function () { $(".accordion-item").removeClass("active"), $(this).parent().addClass("active") }); /*============================================= = Wow Active = =============================================*/ function wowAnimation() { var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 0, mobile: false, live: true }); wow.init(); } })(jQuery);