(function ($) { "use strict"; $(window).on('load', function () { preloader(); wowAnimation(); }); /*------------------------------------------ = preloader -------------------------------------------*/ function preloader() { $('#preloader').fadeOut('slow',function(){ $(this).remove(); }); } //gasp gsap.config({ nullTargetWarn: false, }); /*------------------------------------------ = back to top -------------------------------------------*/ $(window).scroll(function () { if ($(this).scrollTop() > 500) { $('.xb-backtotop').addClass('active'); } else { $('.xb-backtotop').removeClass('active'); } }); $(function () { $(".scroll").on('click', function () { $("html,body").animate({ scrollTop: 0 }, "slow"); return false }); }); /*------------------------------------------ = sticky header -------------------------------------------*/ function stickyHeader() { var scrollDirection = ""; var lastScrollPosition = 0; // Clone and make header sticky if the element with class 'xb-header' exists if ($('.xb-header').length) { $('.xb-header').addClass('original').clone(true).insertAfter('.xb-header').addClass('xb-header-area-sticky xb-sticky-stt').removeClass('original'); } // Handle scroll events $(window).on("scroll", function () { var currentScrollPosition = $(window).scrollTop(); // Determine scroll direction scrollDirection = currentScrollPosition < lastScrollPosition ? "up" : "down"; lastScrollPosition = currentScrollPosition; // Check if element with ID 'xb-header-area' has class 'is-sticky' if ($("#xb-header-area").hasClass("is-sticky")) { // Add or remove classes based on scroll position for sticky header and mobile header if (lastScrollPosition > 100) { $(".xb-header-area-sticky.xb-sticky-stb").addClass("xb-header-fixed"); } else { $(".xb-header-area-sticky.xb-sticky-stb").removeClass("xb-header-fixed"); } // Add or remove classes for sticky header based on scroll direction if (scrollDirection === "up" && lastScrollPosition > 100) { $(".xb-header-area-sticky.xb-sticky-stt").addClass("xb-header-fixed"); } else { $(".xb-header-area-sticky.xb-sticky-stt").removeClass("xb-header-fixed"); } } }); } stickyHeader(); /*------------------------------------------ = header search -------------------------------------------*/ $(".header-search-btn").on("click", function (e) { e.preventDefault(); $(".header-search-form-wrapper").addClass("open"); $('.header-search-form-wrapper input[type="search"]').focus(); $('.body-overlay').addClass('active'); }); $(".xb-search-close").on("click", function (e) { e.preventDefault(); $(".header-search-form-wrapper").removeClass("open"); $("body").removeClass("active"); $('.body-overlay').removeClass('active'); }); /*------------------------------------------ = sidebar -------------------------------------------*/ $('.sidebar-menu-close, .body-overlay').on('click', function () { $('.offcanvas-sidebar').removeClass('active'); $('.body-overlay').removeClass('active'); }); $('.offcanvas-sidebar-btn').on('click', function () { $('.offcanvas-sidebar').addClass('active'); $('.body-overlay').addClass('active'); }); $('.body-overlay').on('click', function () { $(this).removeClass('active'); $(".header-search-form-wrapper").removeClass("open"); }); /*------------------------------------------ = mobile menu -------------------------------------------*/ $('.xb-nav-hidden li.menu-item-has-children > a').append(''); $('.xb-header-menu li.menu-item-has-children, .xb-menu-primary li.menu-item-has-children').append(''); $('.xb-menu-toggle').on('click', function () { if (!$(this).hasClass('active')) { $(this).closest('ul').find('.xb-menu-toggle.active').toggleClass('active'); $(this).closest('ul').find('.sub-menu.active').toggleClass('active').slideToggle(); } $(this).toggleClass('active'); $(this).closest('.menu-item').find('> .sub-menu').toggleClass('active'); $(this).closest('.menu-item').find('> .sub-menu').slideToggle(); }); $('.xb-nav-hidden li.menu-item-has-children > a').click(function (e) { var target = $(e.target); if ($(this).attr('href') === '#' && !(target.is('.xb-menu-toggle'))) { e.stopPropagation(); if (!$(this).find('.xb-menu-toggle').hasClass('active')) { $(this).closest('ul').find('.xb-menu-toggle.active').toggleClass('active'); $(this).closest('ul').find('.sub-menu.active').toggleClass('active').slideToggle(); } $(this).find('.xb-menu-toggle').toggleClass('active'); $(this).closest('.menu-item').find('> .sub-menu').toggleClass('active'); $(this).closest('.menu-item').find('> .sub-menu').slideToggle(); } }); $(".xb-nav-mobile").on('click', function () { $(this).toggleClass('active'); $('.xb-header-menu').toggleClass('active'); }); $(".xb-menu-close, .xb-header-menu-backdrop").on('click', function () { $(this).removeClass('active'); $('.xb-header-menu').removeClass('active'); }); /*------------------------------------------ = nice select -------------------------------------------*/ $('select').niceSelect(); /*------------------------------------------ = data background and bg color -------------------------------------------*/ $("[data-background]").each(function () { $(this).css("background-image", "url(" + $(this).attr("data-background") + ") ") }) $("[data-bg-color]").each(function () { $(this).css("background-color", $(this).attr("data-bg-color")); }); /*------------------------------------------ = aos animation -------------------------------------------*/ function wowAnimation() { var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 0, mobile: true, live: true }); wow.init(); } /*------------------------------------------ = counter -------------------------------------------*/ if ($(".xbo").length) { $('.xbo').appear(); $(document.body).on('appear', '.xbo', function (e) { var odo = $(".xbo"); odo.each(function () { var countNumber = $(this).attr("data-count"); $(this).html(countNumber); }); window.xboOptions = { format: 'd', }; }); } if ($(".xbo_trigger").length) { var odo = $(".xbo_trigger"); odo.each(function () { var countNumber = $(this).attr("data-count"); var odometerInstance = new Odometer({ el: this, value: 0, format: 'd', }); odometerInstance.render(); odometerInstance.update(countNumber); }); $('.xbo_trigger').appear(); $(document.body).on('appear', '.xboh', function (e) { }); } /*------------------------------------------ = isotop -------------------------------------------*/ $('.grid').imagesLoaded(function () { var $grid = $('.grid').isotope({ itemSelector: '.grid-item', percentPosition: true, masonry: { // use outer width of grid-sizer for columnWidth columnWidth: '.grid-item', } }); // filter items on button click $('.career-menu').on('click', 'button', function () { var filterValue = $(this).attr('data-filter'); $grid.isotope({ filter: filterValue }); }); }); //for menu active class $('.career-menu button').on('click', function (event) { $(this).siblings('.active').removeClass('active'); $(this).addClass('active'); event.preventDefault(); }); /*------------------------------------------ = Background Parallaxie - Start -------------------------------------------*/ $(document).ready(function () { $('.parallaxie').parallaxie({ speed: 0.5, offset: 0, }); }); /*------------------------------------------ = smooth scroll -------------------------------------------*/ const lenis = new Lenis({ duration: .8, smoothWheel: true, }); function raf(time) { lenis.raf(time); requestAnimationFrame(raf); } requestAnimationFrame(raf); /*------------------------------------------ = testimonial slide -------------------------------------------*/ var slider = new Swiper(".xb-testimonial-slider", { loop: true, speed: 400, spaceBetween: 30, slidesPerView: 5, centeredSlides: false, autoplay: { enabled: true, delay: 6000 }, breakpoints: { '1700': { slidesPerView: 5, }, '1600': { slidesPerView: 4, }, '1024': { slidesPerView: 3, }, '768': { slidesPerView: 2, }, '576': { slidesPerView: 1, }, '0': { slidesPerView: 1, }, }, }); /*------------------------------------------ = testimonial slide -------------------------------------------*/ var slider = new Swiper(".ac-testimonial-slider", { loop: true, speed: 400, spaceBetween: 30, slidesPerView: 3, centeredSlides: false, autoplay: { enabled: true, delay: 6000 }, breakpoints: { '1600': { slidesPerView: 3, }, '1200': { slidesPerView: 3, }, '1024': { slidesPerView: 1, }, '768': { slidesPerView: 1, }, '576': { slidesPerView: 1, }, '0': { slidesPerView: 1, }, }, }); /*------------------------------------------ = blog slide -------------------------------------------*/ var slider = new Swiper(".blog-slider", { loop: true, speed: 400, spaceBetween: 30, slidesPerView: 1, centeredSlides: false, autoplay: { enabled: true, delay: 6000 }, pagination: { el: ".swiper-pagination", }, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, breakpoints: { '1600': { slidesPerView: 1, }, '1024': { slidesPerView: 1, }, '768': { slidesPerView: 1, }, '576': { slidesPerView: 1, }, '0': { slidesPerView: 1, }, }, }); /*------------------------------------------ = ai-testimonial slide -------------------------------------------*/ var swiper = new Swiper(".ai-testimonial-slider-nav", { loop: true, spaceBetween: 0, slidesPerView: 1, freeMode: true, effect: "fade", watchSlidesProgress: true, allowTouchMove: true, breakpoints: { '992': { slidesPerView: 1, }, '768': { slidesPerView: 1, }, '576': { slidesPerView: 1, }, '0': { slidesPerView: 1, }, }, }); var swiper2 = new Swiper(".ai-testimonial-slider-img", { loop: true, spaceBetween: 0, slidesPerView: 1, navigation: { nextEl: ".swiper-button-next", prevEl: ".swiper-button-prev", }, autoplay: { enabled: true, delay: 6000 }, thumbs: { swiper: swiper, }, }); /*------------------------------------------ = inhover active -------------------------------------------*/ $(".xb-mouseenter").on('mouseenter', function () { $(".xb-mouseenter").removeClass("active"); $(this).addClass("active"); }); $(".xb-mouseenter2").on('mouseenter', function () { $(".xb-mouseenter2").removeClass("active"); $(this).addClass("active"); }); /*------------------------------------------ = click button active -------------------------------------------*/ $(function () { $('.category li').on('click', function () { var active = $('.category li.active'); active.removeClass('active'); $(this).addClass('active'); }); }); /*------------------------------------------ = magnificPopup -------------------------------------------*/ $('.popup-image').magnificPopup({ type: 'image', gallery: { enabled: true } }); $('.popup-video').magnificPopup({ type: 'iframe', mainClass: 'mfp-zoom-in', }); /*------------------------------------------ = Accordion Box -------------------------------------------*/ if ($(".accordion_box").length) { $(".accordion_box").on("click", ".acc-btn", function () { var outerBox = $(this).parents(".accordion_box"); var target = $(this).parents(".accordion"); if ($(this).next(".acc_body").is(":visible")) { $(this).removeClass("active"); $(this).next(".acc_body").slideUp(300); $(outerBox).children(".accordion").removeClass("active-block"); } else { $(outerBox).find(".accordion .acc-btn").removeClass("active"); $(this).addClass("active"); $(outerBox).children(".accordion").removeClass("active-block"); $(outerBox).find(".accordion").children(".acc_body").slideUp(300); target.addClass("active-block"); $(this).next(".acc_body").slideDown(300); } }); } /*------------------------------------------ = marquee -------------------------------------------*/ $('.marquee-left').marquee({ speed: 20, gap: 0, delayBeforeStart: 0, direction: 'left', duplicated: true, pauseOnHover: false, startVisible: true, }); $('.marquee-right').marquee({ speed: 20, gap: 0, delayBeforeStart: 0, direction: 'right', duplicated: true, pauseOnHover: false, startVisible: true, }); /*------------------------------------------ = Language Select -------------------------------------------*/ const locales = ["en-GB","ar-SA","zh-CN","de-DE","es-ES","fr-FR","hi-IN","it-IT","in-ID","ja-JP","ko-KR","nl-NL","no-NO","pl-PL","pt-BR","sv-SE","fi-FI","th-TH","tr-TR","uk-UA","vi-VN","ru-RU","he-IL"]; function getFlagSrc(countryCode) { return /^[A-Z]{2}$/.test(countryCode) ? `https://flagsapi.com/${countryCode.toUpperCase()}/shiny/64.png` : ""; } $(document).ready(function () { function setSelectedLocale(locale) { const intlLocale = new Intl.Locale(locale); const $dropdownContent = $("#language_dropdown > ul"); $dropdownContent.empty(); const otherLocales = locales.filter(loc => loc !== locale); $.each(otherLocales, function (index, otherLocale) { const otherIntlLocale = new Intl.Locale(otherLocale); const otherLangName = new Intl.DisplayNames([otherLocale], { type: "language" }).of(otherIntlLocale.language); const $listEl = $("