1(function($) { 2 "use strict"; 3 4 // Cache commonly used selectors 5 var $window = $(window); 6 var $body = $('body'); 7 var $document = $(document); 8 9 // Consolidated window load event 10 $(window).on("load", function () { 11 // Preloader and loader wrap fade out with a delay 12 var fadeOutTime = 1000; // time in milliseconds 13 var maxLoadTime = 5000; // maximum time to wait before forcefully hiding the elements 14 15 // Handle #preloader-active 16 $("#preloader-active").delay(fadeOutTime).fadeOut("slow"); 17 18 // Handle .loader-wrap 19 $('.loader-wrap').delay(fadeOutTime).fadeOut("slow"); 20 21 // Force hide #preloader-active after maxLoadTime 22 setTimeout(function() { 23 if ($("#preloader-active").is(":visible")) { 24 $("#preloader-active").fadeOut("slow"); 25 } 26 }, maxLoadTime); 27 28 // Force hide .loader-wrap after maxLoadTime 29 setTimeout(function() { 30 if ($('.loader-wrap').is(":visible")) { 31 $('.loader-wrap').fadeOut("slow"); 32 } 33 }, maxLoadTime); 34 }); 35 36 37 38 function luxrideinitializeAll() { 39 luxrideinitServiceCardHeight(); 40 luxrideinitNavbarDropdown(); 41 luxrideinitMobileMenu(); 42 luxrideinitSkeletonLoading(); 43 luxrideinitYearUpdate(); 44 luxrideinitFaqs(); 45 luxrideinitSwiperCarousels_two(); 46 luxride_theme_swiper_sliderbtwo(); 47 luxrideinitCounter(); 48 luxrideinitMenuOverlay(); 49 luxrideinitTabs(); 50 luxrideinitLightbox(); 51 luxrideinitBackToTop(); 52 luxrideinitStickyHeader(); 53 luxrideinitModals(); 54 luxrideinitBookingModal(); 55 luxrideinitAjaxLoaders(); 56 luxride_search(); 57 } 58 // Consolidated document ready event 59 $document.ready(function() { 60 luxrideinitializeAll(); 61 }); 62 function luxrideinitServiceCardHeight() { 63 $document.on('mouseenter mouseleave', '.cardService.one', function(e) { 64 var $this = $(this); 65 var $boxInfo = $this.find('.box-inner-info'); 66 if (e.type === 'mouseenter') { 67 $boxInfo.css('height', $boxInfo[0].scrollHeight + 'px'); 68 } else { 69 $boxInfo.css('height', '0'); 70 } 71 }); 72 } 73 function luxride_search(){ 74 if ($('.luxsearch').length) { 75 //Menu Toggle Btn 76 $('.enableluxsearch').on('click', function() { 77 $('.search_sidebar').addClass('search_sidebar-visible'); 78 }); 79 //Menu Toggle Btn 80 $('.search_sidebar .close-btn , .search_sidebar .menu-backdrop').on('click', function() { 81 $('.search_sidebar').removeClass('search_sidebar-visible'); 82 }); 83 } 84 } 85 function luxrideinitNavbarDropdown() { 86 $('.navbar_nav li.dropdown > a, .navbar_nav li.mega_menu > a').append('<div class="dropdown-btn"><span class="fi-rr-angle-down"></span></div>'); 87 } 88 89 function luxrideinitMobileMenu() { 90 $document.on('click', '.navbar_togglers', function() { 91 $body.toggleClass('mobile_menu_box-visible'); 92 }); 93 94 $document.on('click', '.mobile_menu_box .menu-backdrop, .mobile_menu_box .close-btn', function() { 95 $body.removeClass('mobile_menu_box-visible'); 96 }); 97 98 if ($('.mobile_menu_box').length) { 99 var mobileMenuContent = $('.navbar_nav').html(); 100 $('.mobile_menu_box .navbar_nav').append(mobileMenuContent); 101 } 102 103 var $offCanvasNav = $(".mobile_menu_box"); 104 var $offCanvasNavSubMenu = $offCanvasNav.find(".sub-menu"); 105 106 $offCanvasNavSubMenu.parent().prepend('<span class="dropdown-btn"><i class="fi-rr-angle-down"></i></span>'); 107 $offCanvasNavSubMenu.slideUp(); 108 109 $offCanvasNav.on("click", "li a, li .dropdown-btn", function(e) { 110 var $this = $(this); 111 if ($this.parent().attr("class").match(/\b(menu-item-has-children|has-children|has-sub-menu|sub-menu|mega_menu)\b/) && ($this.attr("href") === "#" || $this.hasClass("dropdown-btn"))) { 112 e.preventDefault(); 113 if ($this.siblings("ul:visible").length) { 114 $this.parent("li").removeClass("drop-active"); 115 $this.siblings("ul").slideUp(); 116 } else { 117 $this.parent("li").addClass("drop-active"); 118 $this.closest("li").siblings("li").removeClass("drop-active").find("li").removeClass("drop-active"); 119 $this.closest("li").siblings("li").find("ul:visible").slideUp(); 120 $this.siblings("ul").slideDown(); 121 } 122 } 123 }); 124 } 125 126 function luxrideinitSkeletonLoading() { 127 var duration = 1000; 128 var timer; 129 130 function toggleSkeletonLoading(show) { 131 $(".sketch-loading")[show ? 'show' : 'hide'](); 132 } 133 134 function resetTimer() { 135 clearTimeout(timer); 136 timer = setTimeout(() => toggleSkeletonLoading(false), duration); 137 } 138 139 $document.on('click', ".load_more_jobs, .job_types li label, .woo_pagination.loadmoreproduct .woocommerce-pagination a", function() { 140 toggleSkeletonLoading(true); 141 resetTimer(); 142 }); 143 } 144 145 function luxrideinitYearUpdate() { 146 function updateYear() { 147 $('.currentYear').text(new Date().getFullYear()); 148 } 149 updateYear(); 150 setInterval(updateYear, 1000); 151 } 152 153 function luxrideinitFaqs() { 154 if ($('.accordion-box').length) { 155 $(".accordion-box").off('click').on('click', '.question', function () { 156 console.log('Accordion question clicked'); 157 var outerBox = $(this).closest('.accordion-box'); 158 var target = $(this).closest('.accordion'); 159 160 // Toggle the active class on the clicked question 161 $(this).toggleClass('active'); 162 163 // Close other open accordions 164 outerBox.find('.accordion .question, .accordion .icon_fq').not(this).removeClass('active'); 165 outerBox.find('.accordion').not(target).removeClass('active-block'); 166 outerBox.find('.accordion').not(target).children('.accordion-content').slideUp(300); 167 168 // Toggle the accordion content 169 var accordionContent = $(this).next('.accordion-content'); 170 if (accordionContent.is(':visible')) { 171 accordionContent.slideUp(300); 172 } else { 173 outerBox.find('.accordion-content').slideUp(300); 174 target.addClass('active-block'); 175 accordionContent.slideDown(300); 176 } 177 }); 178 } 179 } 180 181 function luxrideinitSwiperCarousels_two() { 182 function initSwiperTestimonials(id_class, button_next_class, button_prev_class, pagination, type = "bullets") { 183 var swiper_1_items = new Swiper(id_class, { 184 slidesPerView: 1, 185 loop: true, 186 navigation: { 187 nextEl: button_next_class, 188 prevEl: button_prev_class 189 }, 190 pagination: { 191 el: pagination, 192 clickable: true, 193 type: type 194 }, 195 mousewheel: true, 196 spaceBetween: 30, 197 grabCursor: true, 198 autoplay: { 199 delay: 10000 200 }, 201 on: { 202 beforeInit: function (swiper) { 203 var slides_count = $(id_class).find(".swiper-slide"); 204 var lastNumber = slides_count.length; 205 if (lastNumber > 0) { 206 $(".firstNumber").html("01"); 207 } 208 if (lastNumber > 0) { 209 if (lastNumber < 10) { 210 lastNumber = "0" + lastNumber; 211 } 212 $(".lastNumber").html(lastNumber); 213 } 214 } 215 }, 216 onAny(eventName, ...args) { 217 if (eventName == "slidePrevTransitionEnd" || eventName == "slideNextTransitionEnd") { 218 var activeNum = args[0].realIndex + 1; 219 if (activeNum > 0) { 220 if (activeNum < 10) { 221 activeNum = "0" + activeNum; 222 } 223 $(id_class).find(".firstNumber").html(activeNum); 224 } 225 } 226 } 227 }); 228 } 229 function initSwiper1Iem(id_class, button_next_class, button_prev_class, pagination, type = "bullets") { 230 console.log(type); 231 var swiper_1_items = new Swiper(id_class, { 232 slidesPerView: 1, 233 loop: true, 234 navigation: { 235 nextEl: button_next_class, 236 prevEl: button_prev_class 237 }, 238 pagination: { 239 el: pagination, 240 clickable: true, 241 type: type 242 }, 243 mousewheel: true, 244 spaceBetween: 30, 245 grabCursor: true, 246 autoplay: { 247 delay: 10000 248 } 249 }); 250 } 251 if ($(".swiper-group-testimonials").length > 0) { 252 initSwiperTestimonials(".swiper-group-testimonials", ".swiper-button-next-testimonials", ".swiper-button-prev-testimonials", ".swiper-pagination-testimonials"); 253 } 254 if ($(".swiper-group-testimonials-2").length > 0) { 255 initSwiper1Iem(".swiper-group-testimonials-2", ".swiper-button-next-testimonials-2", ".swiper-button-prev-testimonials-2", ".swiper-pagination-testimonials-2", "fraction"); 256 } 257 if ($(".swiper-group-testimonials-fraction").length > 0) { 258 initSwiper1Iem(".swiper-group-testimonials-fraction", ".swiper-button-next-testimonials-fraction", ".swiper-button-prev-testimonials-fraction", ".swiper-pagination-testimonials-fraction", "fraction"); 259 } 260 } 261 /*---====================---luxride Swiper Active---======================---*/ 262 function luxride_theme_swiper_sliderbtwo() { 263 $(".swiper-group-1-number").each(function () { 264 var swiper_1_items = new Swiper(this, { 265 slidesPerView: 1, 266 loop: false, 267 speed: 1000, 268 mousewheelControl: true, 269 watchSlidesProgress: true, 270 mousewheel: { 271 releaseOnEdges: true 272 }, 273 // onAny(eventName, ...args) { 274 // console.log("Event: ", eventName); 275 // console.log("Event data: ", args); 276 // }, 277 autoHeight: 1, 278 preventInteractionOnTransition: 1, 279 navigation: { 280 nextEl: ".swiper-button-next-group-1-number", 281 prevEl: ".swiper-button-prev-group-1-number" 282 }, 283 pagination: { 284 el: ".swiper-pagination-number", 285 clickable: true, 286 renderBullet: function (index, className) { 287 return '<span class="' + className + '">' + (index + 1) + "</span>"; 288 } 289 }, 290 autoplay: { 291 delay: 10000 292 } 293 }); 294 });
295 } 296 297 function luxrideinitCounter() { 298 $window.on('scroll', function() { 299 $('.count-text').each(function() { 300 if (isElementInViewport($(this)) && !$(this).data('counted')) { 301 $(this).data('counted', true).prop('Counter', 0).animate({ 302 Counter: $(this).text() 303 }, { 304 duration: 2000, 305 easing: 'swing', 306 step: function(now) { 307 $(this).text(Number(Math.ceil(now)).toLocaleString('en')); 308 } 309 }); 310 } 311 }); 312 }); 313 } 314 315 function isElementInViewport(el) { 316 var rect = el[0].getBoundingClientRect(); 317 return ( 318 rect.top >= 0 && 319 rect.left >= 0 && 320 rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && 321 rect.right <= (window.innerWidth || document.documentElement.clientWidth) 322 ); 323 } 324 325 function luxrideinitMenuOverlay() { 326 const menuItems = document.querySelectorAll('.header_area .navbar_nav > li.dropdown'); 327 const menuOverlay = document.querySelector('.menu_overlay'); 328 329 function positionMenuOverlay() { 330 menuItems.forEach(item => { 331 const subMenu = item.querySelector('.sub-menu'); 332 if (subMenu) { 333 const subMenuRect = subMenu.getBoundingClientRect(); 334 menuOverlay.style.top = subMenuRect.top + window.scrollY + 'px'; 335 } 336 }); 337 } 338 339 // Position the menu overlay when the page loads 340 positionMenuOverlay(); 341 342 if (menuOverlay) { 343 menuItems.forEach(item => { 344 item.addEventListener('mouseenter', () => { 345 menuOverlay.classList.add('active'); 346 positionMenuOverlay(); 347 }); 348 349 item.addEventListener('mouseleave', () => { 350 menuOverlay.classList.remove('active'); 351 }); 352 }); 353 } 354 } 355 function luxrideinitTabs() { 356 $document.on('click', '.luxride_tab .showcase_tabs_btns .s_tab_btn', function(e) { 357 e.preventDefault(); 358 var $this = $(this); 359 var target = $($this.attr('data-tab')); 360 var $tabContainer = $this.closest('.luxride_tab'); 361 362 if (!target.hasClass('active-tab show')) { 363 $tabContainer.find('.showcase_tabs_btns .s_tab_btn').removeClass('active'); 364 $this.addClass('active'); 365 $tabContainer.find('.s_tabs_content .s_tab').removeClass('active-tab show'); 366 target.addClass('active-tab show'); 367 } 368 }); 369 370 // Team tab initialization 371 $document.on('click', '.luxride_team_tab .team_tabs_btns .team_tab_btn', function(e) { 372 e.preventDefault(); 373 var $this = $(this); 374 var target = $($this.attr('data-tab')); 375 var $tabContainer = $this.closest('.luxride_team_tab'); 376 377 if (!target.hasClass('active-tab show')) { 378 $tabContainer.find('.team_tabs_btns .team_tab_btn').removeClass('active'); 379 $this.addClass('active'); 380 $tabContainer.find('.team_tabs_content .team_tab').removeClass('active-tab show'); 381 target.addClass('active-tab show'); 382 } 383 }); 384 } 385 386 function luxrideinitLightbox() { 387 if ($('.lightbox-image').length) { 388 $('.lightbox-image').fancybox({ 389 openEffect: 'fade', 390 closeEffect: 'fade', 391 helpers: { 392 media: {} 393 } 394 }); 395 } 396 } 397 398 function luxrideinitBackToTop() { 399 if ($('.prgoress_indicator path').length) { 400 var progressPath = document.querySelector('.prgoress_indicator path'); 401 var pathLength = progressPath.getTotalLength(); 402 progressPath.style.transition = progressPath.style.WebkitTransition = '
402none'; 403 progressPath.style.strokeDasharray = pathLength + ' ' + pathLength; 404 progressPath.style.strokeDashoffset = pathLength; 405 progressPath.getBoundingClientRect(); 406 progressPath.style.transition = progressPath.style.WebkitTransition = 'stroke-dashoffset 10ms linear'; 407 408 function updateProgress() { 409 var scroll = $window.scrollTop(); 410 var height = $document.height() - $window.height(); 411 var progress = pathLength - (scroll * pathLength / height); 412 progressPath.style.strokeDashoffset = progress; 413 } 414 415 updateProgress(); 416 $window.on('scroll', updateProgress); 417 418 var offset = 250; 419 var duration = 550; 420 421 $window.on('scroll', function() { 422 if ($(this).scrollTop() > offset) { 423 $('.prgoress_indicator').addClass('active-progress'); 424 } else { 425 $('.prgoress_indicator').removeClass('active-progress'); 426 } 427 }); 428 429 $('.prgoress_indicator').on('click', function(event) { 430 event.preventDefault(); 431 $('html, body').animate({scrollTop: 0}, duration); 432 return false; 433 }); 434 } 435 } 436 437 function luxrideinitStickyHeader() { 438 var header = $('.sticky_header_area'); 439 $window.on('scroll', function() { 440 var scroll = $window.scrollTop(); 441 if (scroll < 200) { 442 header.removeClass('fixed-header'); 443 } else { 444 header.addClass('fixed-header'); 445 } 446 }); 447 448 $('.sticky_header_area').css({ 449 'transition': 'all 0.43s ease-in-out', 450 }); 451 } 452 453 function luxrideinitModals() { 454 var $modal = $(".modal"); 455 456 function toggleModal(show) { 457 $modal[show ? 'addClass' : 'removeClass']("show-modal"); 458 } 459 460 $document.on('click', '.trigger', function() { 461 toggleModal(true); 462 }); 463 464 $document.on('click', '.close-button, .modal', function(event) { 465 if (event.target === this) { 466 toggleModal(false); 467 } 468 }); 469 } 470 471 function luxrideinitBookingModal() { 472 var $modal = $(".booking_modal"); 473 function toggleModal(show) { 474 $modal[show ? 'addClass' : 'removeClass']("booking_show-modal"); 475 } 476 $document.on('click', '.booking_press_bth', function() { 477 toggleModal(true); 478 }); 479 $document.on('click', '.booking_close-button, .booking_modal', function(event) { 480 if (event.target === this) { 481 toggleModal(false); 482 } 483 }); 484 } 485 486 function luxrideinitAjaxLoaders() { 487 function initAjaxLoader(containerClass, wrapperClass, enabledClass) { 488 $(document).on('click', '.' + enabledClass + ' .pagination-area a', function(e) { 489 e.preventDefault(); 490 var $this = $(this); 491 var $container = $('.' + containerClass); 492 var $pagination = $this.closest('.pagination-area'); 493 494 if ($container.data('requestRunning')) { 495 return; 496 } 497 $container.data('requestRunning', true); 498 499 // Add the loader 500 $container.append('<div class="loader"><span class="loader-inner"></span></div>'); 501 502 $.ajax({
503 url: $this.attr('href'), 504 type: 'GET', 505 dataType: 'html', 506 success: function(response) { 507 var $response = $(response); 508 var $newContent = $response.find('.' + containerClass).children('.' + wrapperClass); 509 var $newPagination = $response.find('.pagination-area'); 510 511 if ($newContent.length && $newPagination.length) { 512 // Append new content 513 $newContent.hide().appendTo($container).fadeIn(500); 514 // Update pagination 515 $pagination.html($newPagination.html()); 516 } else { 517 console.error('Could not find content or pagination in the response'); 518 } 519 }, 520 error: function(xhr, status, error) { 521 console.error('Ajax request failed:', error); 522 }, 523 complete: function() { 524 $container.data('requestRunning', false); 525 $('.loader').remove(); 526 } 527 }); 528 }); 529 } 530 531 // Initialize for each type 532 initAjaxLoader('ajax_container', 'ajax-wrapper', 'ajax_posts_enabled'); 533 initAjaxLoader('fleet_container', 'fleet-wrapper', 'ajax_fleets_enabled'); 534 initAjaxLoader('service_container', 'service-wrapper', 'ajax_services_enabled'); 535 initAjaxLoader('team_container', 'team-wrapper', 'ajax_teams_enabled'); 536 } 537 538 // function tab fleet 539 function tabfleet() { 540 var fleettabslider = new Swiper(".fleettabslider", { 541 spaceBetween: 30, 542 slidesPerView: 4, 543 freeMode: true, 544 loop: false, 545 watchSlidesProgress: true, 546 navigation: { // Add arrow navigation for thumb slider 547 nextEl: ".fleettabslider-button-next", 548 prevEl: ".fleettabslider-button-prev" 549 }, 550 breakpoints: { 551 // When window width is >= 640px 552 0: { 553 slidesPerView: 1, 554 }, 555 // When window width is >= 640px 556 640: { 557 slidesPerView: 2, 558 }, 559 // When window width is >= 768px 560 768: { 561 slidesPerView: 3, 562 }, 563 // When window width is >= 1024px 564 1024: { 565 slidesPerView: 4, 566 } 567 } 568 }); 569 570 var swiper2 = new Swiper(".fleettabslider2", { 571 spaceBetween: 30, 572 navigation: { // Arrow navigation for main slider 573 nextEl: ".fleettabslider2-button-next", 574 prevEl: ".fleettabslider2-button-prev" 575 }, 576 pagination: { // Dot pagination for main slider 577 el: ".fleettabslider2-pagination", 578 clickable: true 579 }, 580 thumbs: { 581 swiper: fleettabslider 582 }, 583 loop: false 584 }); 585 } 586 tabfleet(); 587 // function tab fleet 588 // function tab testi 589 function testisliderfunction() { 590 var testtabslider = new Swiper(".testtabslider", { 591 spaceBetween: 0, 592 freeMode: false, 593 loop: true, centeredSlides: true, // Center the active slide 594 navigation: { 595 nextEl: ".testtabslider-button-next", 596 prevEl: ".testtabslider-button-prev" 597 }, 598 breakpoints: { 599 // When window width is >= 640px 600 0: { 601 slidesPerView: 1, 602 }, 603 // When window width is >= 640px 604 640: { 605 slidesPerView: 2, 606 }, 607 // When window width is >= 768px 608 768: { 609 slidesPerView: 3, 610 }, 611 // When window width is >= 1024px 612 1024: { 613 slidesPerView:5, 614 } 615 } 616 }); 617 618 var swiper2 = new Swiper(".testtabslider2", { 619 spaceBetween: 30, 620 navigation: { 621 nextEl: ".testtabslider2-button-next", 622 prevEl: ".testtabslider2-button-prev" 623 }, 624 pagination: { 625 el: ".testtabslider2-pagination", 626 clickable: true 627 }, 628 thumbs: { 629 swiper: testtabslider 630 }, 631 loop: false, 632 }); 633 } 634 635 testisliderfunction(); 636 637 // function tab testi 638function testisliderfunction_four() { 639 var sliderEl = document.querySelector(".testtabslider_four"); 640 if (!sliderEl) return; 641 642 var autoplay = sliderEl.dataset.autoplay === 'true'; 643 var autoplaySpeed = parseInt(sliderEl.dataset.autoplaySpeed) || 3000; 644 var speed = parseInt(sliderEl.dataset.speed) || 300; 645 var slidesLaptop = parseInt(sliderEl.dataset.slidesLaptop) || 2; 646 var slidesDesktop = parseInt(sliderEl.dataset.slidesDesktop) || 2; 647 648 var testtabslider = new Swiper(".testtabslider_four", { 649 spaceBetween: 0, 650 freeMode: false, 651 loop: true, 652 centeredSlides: false, // Center the active slide 653 speed: speed, 654 navigation: { 655 nextEl: ".testtabslider_four-button-next", 656 prevEl: ".testtabslider_four-button-prev" 657 }, 658 pagination: { 659 el: ".testtabslider_four-pagination", 660 clickable: true, 661 dynamicBullets: true // Optional: for dynamic bullet count on smaller screens 662 }, 663 ...(autoplay && { 664 autoplay: { 665 delay: autoplaySpeed, 666 disableOnInteraction: false 667 } 668 }), 669 breakpoints: { 670 // When window width is >= 640px 671 0: { 672 slidesPerView: 1, 673 }, 674 // When window width is >= 640px 675 640: { 676 slidesPerView: 1, 677 }, 678 // When window width is >= 768px 679 1024: { 680 slidesPerView: slidesLaptop, 681 }, 682 // When window width is >= 1024px 683 1200: { 684 slidesPerView: slidesDesktop, 685 } 686 } 687 });
688 689 // Check swiper wrapper width and add class if less than 1200px 690 var wrapper = sliderEl.querySelector('.swiper-wrapper'); 691 if (wrapper && wrapper.offsetWidth < 1200) { 692 wrapper.classList.add('added_width'); 693 } 694} 695 // function tab fleet 696// Initialize Fleet Accordion functionality 697function initFleetAccordion() { 698 // Find all fleet accordion containers 699 const fleetContainers = document.querySelectorAll('.fleet-accordion'); 700 701 // Generate unique ID for each fleet container if not already present 702 fleetContainers.forEach((container, containerIndex) => { 703 const containerId = container.id || `fleet-container-${containerIndex}`; 704 container.id = containerId; 705 706 // Get all accordion headers within this specific container 707 const accordionHeaders = container.querySelectorAll('.accordion-header'); 708 709 // Update data-target attributes to be unique per container 710 accordionHeaders.forEach((header, headerIndex) => { 711 const originalTarget = header.getAttribute('data-target'); 712 const newTarget = `${containerId}-content-${headerIndex}`; 713 const contentSection = document.querySelector(originalTarget); 714 715 if(contentSection) { 716 contentSection.id = newTarget; 717 header.setAttribute('data-target', `#${newTarget}`); 718 } 719 }); 720 721 // Set first item active by default in this container 722 const firstHeader = accordionHeaders[0]; 723 if(firstHeader) { 724 const firstContent = document.querySelector(firstHeader.getAttribute('data-target')); 725 if(firstHeader && firstContent) { 726 firstHeader.classList.add('active'); 727 firstHeader.setAttribute('aria-expanded', 'true'); 728 firstContent.classList.add('show'); 729 } 730 } 731 732 // Add click event listeners to all headers in this container 733 accordionHeaders.forEach(header => { 734 header.addEventListener('click', function(e) { 735 e.preventDefault(); 736 737 // Get target content element 738 const targetId = this.getAttribute('data-target'); 739 const targetContent = container.querySelector(targetId); 740 741 // If clicking the already active header, do nothing 742 if (this.classList.contains('active')) { 743 return; 744 } 745 746 // Close all accordion items in THIS container only 747 accordionHeaders.forEach(header => { 748 if (header !== this) { 749 header.classList.remove('active'); 750 header.setAttribute('aria-expanded', 'false'); 751 const content = container.querySelector(header.getAttribute('data-target')); 752 if(content) { 753 content.classList.remove('show'); 754 content.classList.add('closing'); 755 setTimeout(() => { 756 content.classList.remove('closing'); 757 }, 300); 758 } 759 } 760 }); 761 762 // Open the clicked accordion 763 this.classList.add('active'); 764 this.setAttribute('aria-expanded', 'true'); 765 if(targetContent) { 766 targetContent.classList.add('show'); 767 } 768 }); 769 }); 770 771 // Keyboard navigation within this container 772 accordionHeaders.forEach(header => { 773 header.addEventListener('keydown', function(e) { 774 const currentContainer = this.closest('.fleet-accordion'); 775 776 switch(e.key) { 777 case 'Enter': 778 case 'Space': 779 e.preventDefault(); 780 this.click(); 781 break; 782 case 'ArrowDown': 783 e.preventDefault(); 784 const nextHeader = this.parentElement.nextElementSibling?.querySelector('.accordion-header'); 785 if(nextHeader && nextHeader.closest('.fleet-accordion') === currentContainer) {
786 nextHeader.focus(); 787 } 788 break; 789 case 'ArrowUp': 790 e.preventDefault(); 791 const prevHeader = this.parentElement.previousElementSibling?.querySelector('.accordion-header'); 792 if(prevHeader && prevHeader.closest('.fleet-accordion') === currentContainer) { 793 prevHeader.focus(); 794 } 795 break; 796 } 797 }); 798 }); 799 }); 800} 801 802// Run on page load 803document.addEventListener('DOMContentLoaded', initFleetAccordion); 804 805// Handle dynamically added fleet accordions 806function initDynamicFleetAccordions() { 807 // Find all uninitialized fleet accordions 808 const uninitializedAccordions = document.querySelectorAll('.fleet-accordion:not([data-initialized])'); 809 810 if(uninitializedAccordions.length > 0) { 811 uninitializedAccordions.forEach(accordion => { 812 accordion.setAttribute('data-initialized', 'true'); 813 }); 814 initFleetAccordion(); 815 } 816} 817 818/*---====================---Megamenu---======================---*/ 819function lawnshaper_adjustMegaMenu() { 820 // Only run the function if the window width is at least 1200px 821 if (window.innerWidth >= 1200) { 822 const navbarNav = document.querySelector('.navbar_nav'); 823 const megaMenuItems = document.querySelectorAll('.navbar_nav > li.mega_menu , .navbar_nav > li.flex_menu_activate.menu_fullwidth'); 824 825 megaMenuItems.forEach(item => { 826 const subMenu = item.querySelector('.sub-menu'); 827 if (subMenu) { 828 const itemRect = item.getBoundingClientRect(); 829 // Set the sub-menu position and width 830 subMenu.style.left = `-${itemRect.left}px`; 831 subMenu.style.width = `${window.innerWidth}px`; 832 subMenu.style.maxWidth = `${window.innerWidth}px`; 833 834 // Add class that applies display: flex !important 835 subMenu.classList.add('submenu-visible'); 836 } 837 }); 838 } else { 839 // Reset styles for screens smaller than 1200px 840 const subMenus = document.querySelectorAll('.navbar_nav .sub-menu'); 841 subMenus.forEach(subMenu => { 842 subMenu.style.left = ''; 843 subMenu.style.width = ''; 844 subMenu.style.maxWidth = ''; 845 subMenu.classList.remove('submenu-visible'); 846 }); 847 } 848} 849 850// Run on page load (DOMContentLoaded) and window resize 851window.addEventListener('DOMContentLoaded', function() { 852 setTimeout(lawnshaper_adjustMegaMenu, 500); // Delay to ensure all elements are ready 853}); 854window.addEventListener('resize', lawnshaper_adjustMegaMenu); 855 856function luxrideinitSwiperCarousels() { 857 // Check if we're in Elementor editor 858 if (window.elementorFrontend && elementorFrontend.isEditMode()) { 859 // Delay initialization in editor 860 setTimeout(function() { 861 var swiperElements = document.querySelectorAll('.swiper_container'); 862 swiperElements.forEach(function(swiperElement) { 863 // Destroy existing Swiper instances if any 864 if (swiperElement.swiper) { 865 swiperElement.swiper.destroy(); 866 } 867 868 var swiperOptions = JSON.parse(swiperElement.getAttribute('data-swiper')); 869 var mySwiper = new Swiper(swiperElement, { 870 ...swiperOptions, 871 on: { 872 init: function() { 873 this.update(); 874 } 875 } 876 }); 877 878 swiperElement.addEventListener('mouseenter', function() { 879 mySwiper.autoplay.stop(); 880 }); 881 882 swiperElement.addEventListener('mouseleave', function() { 883 mySwiper.autoplay.start(); 884 }); 885 }); 886 }, 100); 887 } else { 888 document.addEventListener('DOMContentLoaded', function() { 889 var swiperElements = document.querySelectorAll('.swiper_container');
890 swiperElements.forEach(function(swiperElement) { 891 var swiperOptions = JSON.parse(swiperElement.getAttribute('data-swiper')); 892 var mySwiper = new Swiper(swiperElement, { 893 ...swiperOptions, 894 on: { 895 init: function() { 896 this.update(); 897 } 898 } 899 }); 900 901 swiperElement.addEventListener('mouseenter', function() { 902 mySwiper.autoplay.stop(); 903 }); 904 905 swiperElement.addEventListener('mouseleave', function() { 906 mySwiper.autoplay.start(); 907 }); 908 }); 909 }); 910 } 911} 912luxrideinitSwiperCarousels(); 913 914 function luxride_scroll_items() { 915 let selector = '.scroll_carousel_box'; // Replace with your fixed selector 916 let elems = document.querySelectorAll(selector); 917 if (elems.length > 0) { 918 elems.forEach(item => { 919 let $this = item; 920 let _speed = $this.dataset.speed ? JSON.parse($this.dataset.speed) : null; 921 let _smartSpeed = $this.dataset.smartSpeed ? JSON.parse($this.dataset.smartSpeed) : false; 922 let _autoplay = $this.dataset.autoplay ? JSON.parse($this.dataset.autoplay) : true; 923 let _margin = $this.dataset.margin ? JSON.parse($this.dataset.margin) : null; 924 let _dir = $this.dataset.dir ? $this.dataset.dir : 'ltr'; 925 926 // Assuming the ScrollCarousel class is defined and included properly 927 const scrollText = new ScrollCarousel($this, { 928 speed: _speed, 929 margin: _margin, 930 direction: _dir, 931 autoplay: _autoplay, 932 smartSpeed: _smartSpeed, 933 }); 934 }); 935 } 936 } 937 938 class MovingTitleWidget { 939 constructor(container) { 940 this.container = $(container); 941 this.wrapper = this.container.find('.moving-title-wrapper'); 942 this.titleWords = this.container.find('.title-word'); 943 this.pauseOnHover = this.container.data('pause-on-hover') === true; 944 this.animationSpeed = this.container.data('speed') || 25; 945 946 this.init(); 947 } 948 949 init() { 950 this.setupAnimation(); 951 this.setupHoverEffects(); 952 this.clearInlineStyles(); 953 } 954 955 setupAnimation() { 956 this.wrapper.css({ 957 'animation-duration': this.animationSpeed + 's' 958 }); 959 } 960 961 setupHoverEffects() { 962 const self = this; 963 964 this.titleWords.each(function() { 965 const $word = $(this); 966 const $image = $word.find('.hover-image'); 967 968 if ($image.length > 0) { 969 $word.on('mouseenter.movingTitle', function() { 970 if (self.pauseOnHover) { 971 self.container.addClass('animation-paused'); 972 } 973 }); 974 975 $word.on('mouseleave.movingTitle', function() { 976 if (self.pauseOnHover) { 977 self.container.removeClass('animation-paused'); 978 } 979 }); 980 } 981 }); 982 983 this.container.on('mouseleave.movingTitle', function() { 984 self.container.removeClass('animation-paused'); 985 }); 986 } 987 988 clearInlineStyles() { 989 this.titleWords.each(function() { 990 const $word = $(this); 991 const $image = $word.find('.hover-image'); 992 993 if ($image.length > 0) { 994 $image.css({ 995 'top': '', 996 'left': '', 997 'transform': '', 998 'position': '', 999 'width': '', 1000 'height': '' 1001 }); 1002 } 1003 }); 1004 } 1005 1006 destroy() { 1007 this.titleWords.off('.movingTitle'); 1008 this.container.off('.movingTitle'); 1009 $(window).off('.movingTitle'); 1010 } 1011 1012 pause() { 1013 this.container.addClass('animation-paused'); 1014 } 1015 1016 resume() { 1017 this.container.removeClass('animation-paused'); 1018 } 1019 1020 setSpeed(speed) { 1021 this.animationSpeed = speed; 1022 this.wrapper.css('animation-duration', speed + 's'); 1023 } 1024 } 1025 1026 function initMovingTitleWidgets() { 1027 $('.moving-title-container').each(function() { 1028 const $container = $(this); 1029 1030 if (!$container.data('movingTitleWidget')) { 1031 const widget = new MovingTitleWidget(this); 1032 $container.data('movingTitleWidget', widget); 1033 } 1034 }); 1035 } 1036 1037 $(document).ready(function() { 1038 initMovingTitleWidgets(); 1039 });
1040 1041 window.MovingTitleWidget = MovingTitleWidget; 1042 1043 // Elementor hooks 1044 $window.on('elementor/frontend/init', function() { 1045 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-slider-builder.default', luxrideinitSwiperCarousels); 1046 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-slider-builder.default', luxride_theme_swiper_sliderbtwo); 1047 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-slider-1.default', luxrideinitSwiperCarousels); 1048 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-client-carousel-widget.default', luxrideinitSwiperCarousels); 1049 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-tab-with-content-v1.default', luxrideinitSwiperCarousels); 1050 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-image-carousel-widget.default', luxrideinitSwiperCarousels); 1051 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-contact-form-v1.default', luxrideinitTabs); 1052 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-metform-v1.default', luxrideinitTabs); 1053 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-fun-facts-box.default', luxrideinitCounter); 1054 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-service-carousel-v1.default', luxrideinitSwiperCarousels); 1055 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-service-grid-v1.default', luxrideinitAjaxLoaders); 1056 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-blog-carousel-v1.default', luxrideinitSwiperCarousels); 1057 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-blog-grid-v1.default', luxrideinitAjaxLoaders); 1058 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-fleet-carousel-v1.default', luxrideinitSwiperCarousels); 1059 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-tab-fleet-carousel-v1.default', luxrideinitSwiperCarousels); 1060 1061 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-fleet-grid-v1.default', luxrideinitAjaxLoaders); 1062 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-testimonial-carousel-v1.default', luxrideinitSwiperCarousels_two); 1063 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-faqs-v1.default', luxrideinitFaqs); 1064 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-tab-team-content-v1.default', luxrideinitTabs); 1065 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-team-grid-v1.default', luxrideinitAjaxLoaders); 1066 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-contact-form-v1.default', luxrideinitModals); 1067 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-metform-v1.default', luxrideinitModals); 1068 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-Booking.default', luxrideinitBookingModal); 1069 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-extra-items-v1.default', luxride_search); 1070 // tab fleet 1071 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-tab-fleet-content-v1.default', tabfleet); 1072 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-accordin-fleet-content-v1.default', initFleetAccordion); 1073 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-testimonial-carousel-v3.default', testisliderfunction); 1074 1075 1076 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-instagram-v1.default', luxride_scroll_items); 1077 elementorFrontend.hooks.addAction('frontend/element_ready/moving_title.default', initMovingTitleWidgets); 1078 elementorFrontend.hooks.addAction('frontend/element_ready/luxride-testimonial-carousel-v4.default', testisliderfunction_four); 1079 1080 1081 }); 1082 jQuery(window).on('load', function() { 1083 (function($) { 1084 luxride_scroll_items(); 1085 1086 1087 testisliderfunction_four(); 1088 })(jQuery); 1089 });
1090 // Trigger WooCommerce fragment refresh 1091 $(document.body).trigger('wc_fragment_refresh'); 1092 1093 jQuery(document).ready(function($) { 1094 var $year = $('.year'); 1095 if ($year.length) { 1096 $year.text(new Date().getFullYear()); 1097 } 1098}); 1099 1100})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.