document.addEventListener("DOMContentLoaded", function () { /* =============================== * jQuery safety * =============================== */ const $ = window.jQuery; if (!$) { console.error("jQuery not loaded"); return; } /* =============================== * TAB → SWIPER SYNC * =============================== */ const getMainSwiper = () => document.querySelector('.elementor-slides-wrapper')?.swiper; $('.tab-one').addClass('active'); function activateButtonByIndex(index) { $('.tab-one, .tab-two, .tab-three, .tab-four').removeClass('active'); $('.tab-one').eq(index === 0).addClass('active'); $('.tab-two').eq(index === 1).addClass('active'); $('.tab-three').eq(index === 2).addClass('active'); $('.tab-four').eq(index === 3).addClass('active'); } $('.tab-one').on('click', () => getMainSwiper()?.slideTo(0)); $('.tab-two').on('click', () => getMainSwiper()?.slideTo(1)); $('.tab-three').on('click', () => getMainSwiper()?.slideTo(2)); $('.tab-four').on('click', () => getMainSwiper()?.slideTo(3)); function attachSwiperListener(tryCount = 0) { const swiper = getMainSwiper(); if (!swiper) { if (tryCount < 20) { setTimeout(() => attachSwiperListener(tryCount + 1), 200); } return; } swiper.on('slideChange', () => { activateButtonByIndex(swiper.activeIndex); }); } attachSwiperListener(); /* =============================== * TESTIMONIAL NEXT BUTTON * =============================== */ const getTestimonialSwiper = () => document.querySelector('.testimonial-slide .elementor-main-swiper')?.swiper; $('.next-testimonial').on('click', function (e) { e.preventDefault(); e.stopPropagation(); const swiper = getTestimonialSwiper(); if (swiper) swiper.slideNext(); }); /* =============================== * FAQ TOGGLE (NULL SAFE) * =============================== */ const btn = document.querySelector('.faq-btn-link'); const group2 = document.querySelector('.faq-group-2'); const group3 = document.querySelector('.faq-group-3'); if (btn && group2 && group3) { let step = 0; btn.addEventListener('click', function (e) { e.preventDefault(); step++; if (step === 1) { group2.style.display = 'block'; btn.innerText = 'Show more common questions'; } else if (step === 2) { group3.style.display = 'block'; btn.innerText = 'Show less'; } else { group2.style.display = 'none'; group3.style.display = 'none'; btn.innerText = 'Show more common questions'; step = 0; } }); } /* =============================== * ACCORDION ACTIVE CLASS * =============================== */ document.querySelectorAll('.elementor-tab-title').forEach(item => { item.addEventListener('click', function () { document .querySelectorAll('.eael-accordion-list') .forEach(el => el.classList.remove('has-active')); const parent = this.closest('.eael-accordion-list'); if (parent) parent.classList.add('has-active'); }); }); /* =============================== * MOBILE MENU DROPDOWN * =============================== */ document .querySelectorAll('.elementor-nav-menu--dropdown .menu-item-has-children > a') .forEach(link => { link.addEventListener('click', function (e) { e.preventDefault(); const li = this.closest('.menu-item-has-children'); const menu = this.closest('.elementor-nav-menu--dropdown'); if (!li || !menu) return; menu.querySelectorAll('.menu-item-has-children').forEach(item => { if (item !== li) { item.classList.remove('open'); item.querySelector('.sub-menu')?.style.setProperty('display', 'none'); } }); li.classList.toggle('open'); const submenu = li.querySelector('.sub-menu'); if (submenu) { submenu.style.display = submenu.style.display === 'block' ? 'none' : 'block'; } }); }); }); document.addEventListener("DOMContentLoaded", function () { /*! * SelectBox (Elementor-safe, Bottom-only) * Requires jQuery */ (function ($) { /* =============================== * SelectBox Constructor * =============================== */ var SelectBox = window.SelectBox = function (element, options) { if (!element || element.tagName.toLowerCase() !== 'select') return; this.$select = $(element); this.options = options || {}; if (this.$select.data('selectBox-initialized')) return; this.init(); }; /* =============================== * INIT * =============================== */ SelectBox.prototype.init = function () { var self = this; this.$control = $(''); this.$label = $(''); this.$arrow = $(''); this.$menu = $(''); this.$label.html(this.getLabel()); this.buildMenu(); this.$control .append(this.$label) .append(this.$arrow); this.$select .after(this.$control) .hide() .data('selectBox-initialized', true) .data('selectBox-control', this.$control) .data('selectBox-options', this.$menu); $('body').append(this.$menu); /* =============================== * EVENTS * =============================== */ this.$control.on('mousedown', function (e) { e.preventDefault(); self.toggleMenu(); }); this.$menu.on('click', 'a', function (e) { e.preventDefault(); self.selectOption($(this)); }); $(document).on('mousedown.selectBox', function (e) { if (!$(e.target).closest('.selectBox, .selectBox-dropdown-menu').length) { self.hideMenu(); } }); }; /* =============================== * BUILD MENU * =============================== */ SelectBox.prototype.buildMenu = function () { var self = this; this.$menu.empty(); this.$select.find('option').each(function () { var $opt = $(this); var $li = $('
  • '); var $a = $('') .attr('rel', $opt.val()) .text($opt.text()); if ($opt.is(':selected')) { $li.addClass('selectBox-selected'); } $li.append($a); self.$menu.append($li); }); }; /* =============================== * GET LABEL * =============================== */ SelectBox.prototype.getLabel = function () { return this.$select.find('option:selected').text() || ' '; }; /* =============================== * TOGGLE MENU (BOTTOM ONLY) * =============================== */ SelectBox.prototype.toggleMenu = function () { if (this.$control.hasClass('selectBox-menuShowing')) { this.hideMenu(); return; } this.showMenu(); }; /* =============================== * SHOW MENU (FORCED BOTTOM) * =============================== */ SelectBox.prototype.showMenu = function () { var offset = this.$control.offset(); var height = this.$control.outerHeight(); this.hideAllMenus(); this.$menu.css({ top: offset.top + height + 0, left: offset.left, minWidth: this.$control.outerWidth() }).show(); this.$control .addClass('selectBox-menuShowing selectBox-menuShowing-bottom') .removeClass('selectBox-menuShowing-top'); }; /* =============================== * HIDE MENU * =============================== */ SelectBox.prototype.hideMenu = function () { this.$menu.hide(); this.$control.removeClass( 'selectBox-menuShowing selectBox-menuShowing-bottom selectBox-menuShowing-top' ); }; SelectBox.prototype.hideAllMenus = function () { $('.selectBox-dropdown-menu').hide(); $('.selectBox-menuShowing') .removeClass('selectBox-menuShowing selectBox-menuShowing-bottom selectBox-menuShowing-top'); }; /* =============================== * SELECT OPTION * =============================== */ SelectBox.prototype.selectOption = function ($a) { var value = $a.attr('rel'); this.$select.val(value).trigger('change'); this.$label.text($a.text()); this.$menu.find('li').removeClass('selectBox-selected'); $a.parent().addClass('selectBox-selected'); this.hideMenu(); }; /* =============================== * jQuery PLUGIN * =============================== */ $.fn.selectBox = function (options) { return this.each(function () { new SelectBox(this, options); }); }; })(jQuery); /* =============================== * AUTO INIT * =============================== */ jQuery(function ($) { $('.page-template-default select').selectBox(); /* =============================== * Hide SelectBox dropdown on load * =============================== */ $('.selectBox-dropdown-menu.selectBox-options').hide(); }); }); document.addEventListener("DOMContentLoaded", function () { document.body.addEventListener("click", function (e) { const trigger = e.target.closest(".video-popup-trigger"); if (!trigger) return; e.preventDefault(); const videoUrl = trigger.getAttribute("data-video"); if (!videoUrl) return; // Open Elementor popup if (typeof elementorProFrontend !== "undefined") { elementorProFrontend.modules.popup.showPopup({ id: 21851 }); } // Wait for popup DOM render setTimeout(() => { const iframe = document.querySelector("#popup-video-frame"); if (iframe) { iframe.src = videoUrl + "?autoplay=1&rel=0"; } }, 300); }); // Reset video when popup closes document.addEventListener("elementor/popup/hide", function () { const iframe = document.querySelector("#popup-video-frame"); if (iframe) iframe.src = ""; }); });