jQuery(function($) { "use strict"; // Scroll to top functionality $(window).on('scroll', function() { if ($(this).scrollTop() >= 50) { $('#return-to-top').fadeIn(200); } else { $('#return-to-top').fadeOut(200); } }); $('#return-to-top').on('click', function() { $('body,html').animate({ scrollTop: 0 }, 500); }); // Side navigation toggle $('.gb_toggle').on('click', function() { air_condition_repair_Keyboard_loop($('.side_gb_nav')); }); // Preloader fade out setTimeout(function() { $(".loader").fadeOut("slow"); }, 1000); }); // Mobile responsive menu function air_condition_repair_menu_open_nav() { jQuery(".sidenav").addClass('open'); } function air_condition_repair_menu_close_nav() { jQuery(".sidenav").removeClass('open'); } // slider jQuery(document).ready(function($) { // Slider $(document).ready(function() { $('#slider .slides.owl-carousel').owlCarousel({ loop: true, margin: 0, nav: false, dots: true, rtl: false, items: 1, autoplay: false, autoplayTimeout: 3000, autoplayHoverPause: true, }); }); }); // companies logo jQuery(document).ready(function($) { $('.owl-carousel-brand').owlCarousel({ loop: true, margin: 10, nav: false, dots: false, autoplay: false, autoplayTimeout: 3000, responsive: { 0: { items: 3 }, 600: { items: 3 }, 992: { items: 4 }, 1200: { items: 6 } } }); }); // service js jQuery(document).ready(function($) { $('#service-section .owl-carousel').owlCarousel({ loop: true, margin: 50, nav: false, dots: false, autoplay: false, responsive: { 0: { items: 1 }, 768: { items: 2 }, 1000: { items: 3 } } }); }); // share icon jQuery(function($) { function air_condition_repair_shareDropdownHandler() { const shareToggle = $('.share-box'); const shareBox = $('.share-options'); // Toggle dropdown shareToggle.on('click keydown', function(e) { if (e.type === 'click' || (e.type === 'keydown' && (e.which === 13 || e.which === 32))) { e.preventDefault(); e.stopPropagation(); const $icon = $(this); const $options = $icon.siblings('.share-options'); const isOpen = $icon.attr('aria-expanded') === 'true'; // Close all first $('.share-box').attr('aria-expanded', 'false'); $('.share-options').hide(); $('body').removeClass('share-open'); if (!isOpen) { $icon.attr('aria-expanded', 'true'); $options.show(); $('body').addClass('share-open'); $options.find('a:first').focus(); } } }); // ESC to close $(document).on('keyup', function(e) { if (e.keyCode === 27 && $('body').hasClass('share-open')) { $('.share-box').attr('aria-expanded', 'false'); $('.share-options').hide(); $('body').removeClass('share-open'); } }); // Click outside to close $(document).on('click', function(e) { if ($('body').hasClass('share-open') && !$(e.target).closest('.share-icon').length) { $('.share-box').attr('aria-expanded', 'false'); $('.share-options').hide(); $('body').removeClass('share-open'); } }); } // Initialize air_condition_repair_shareDropdownHandler(); });