(function ($) { 'use strict'; // Home Slide Carousel Initialization function homeSlide() { $('.slide-carousel').owlCarousel({ loop: true, autoplay: true, autoplayTimeout: 3000, // Corrected the property for delay margin: 10, nav: true, navText: ["", ""], dots: false, responsive: { 0: { items: 1 }, 600: { items: 1 }, 1000: { items: 1 } } }); } homeSlide(); // Keyboard Navigation for Menu document.addEventListener('DOMContentLoaded', function () { const menu = document.querySelector('.menu'); // Replace with your menu class or ID if (menu) { const menuItems = menu.querySelectorAll('li > a'); menuItems.forEach((item, index) => { item.setAttribute('tabindex', '0'); // Make all menu items focusable // Keyboard event listener item.addEventListener('keydown', (e) => { switch (e.key) { case 'ArrowDown': e.preventDefault(); focusNextMenuItem(index, menuItems); break; case 'ArrowUp': e.preventDefault(); focusPreviousMenuItem(index, menuItems); break; case 'Enter': case ' ': e.preventDefault(); item.click(); // Trigger click on Enter or Space break; default: break; } }); }); function focusNextMenuItem(currentIndex, items) { const nextIndex = (currentIndex + 1) % items.length; items[nextIndex].focus(); } function focusPreviousMenuItem(currentIndex, items) { const prevIndex = (currentIndex - 1 + items.length) % items.length; items[prevIndex].focus(); } } }); // Price Filter Functionality function priceFilter() { var postFilter = $('.filter-init'); $.each(postFilter, function () { var el = $(this); var $selector = $('#' + el.attr('id')); $($selector).imagesLoaded(function () { var festivarMasonry = $($selector).isotope({ itemSelector: '.filter-item', percentPosition: true, masonry: { columnWidth: 0, gutter: 0 } }); $('.collapse').on('shown.bs.collapse hidden.bs.collapse', function () { festivarMasonry.isotope('layout'); }); $(document).on('click', '.' + el.parent().attr('class') + ' .tab-filter a', function () { var filterValue = $(this).attr('data-filter'); festivarMasonry.isotope({ filter: filterValue, animationOptions: { duration: 450, easing: "linear", queue: false, } }); return false; }); $('.filter-wrapper .tab-filter a:first-child').click(); }); }); } priceFilter(); $(document).on('click', '.tab-filter a', function () { $(this).siblings().removeClass('active'); $(this).addClass('active'); }); // Counter Up $('.counter').counterUp({ delay: 10, time: 1000 }); // Mobile Menu Toggle function menuSmall() { $(".dropdown-toggle").on("click", function (e) { if (window.innerWidth <= 991) { e.preventDefault(); $(this).parent().toggleClass("current"); $(this).next().slideToggle(); } }); } menuSmall(); // Scroll to Top Functionality function scrolltop() { $(window).on('scroll', function () { if ($(this).scrollTop() > 200) { $('.scrollingUp').addClass('is-active'); } else { $('.scrollingUp').removeClass('is-active'); } }); $('.scrollingUp').on('click', function () { $("html, body").animate({ scrollTop: 0 }, 600); return false; }); } scrolltop(); // Sticky Menu Functionality function Stickymenu() { if ($(".sticky").length > 0) { $(window).on('scroll', function () { if ($(window).scrollTop() >= 250) { $('.sticky').addClass('sticky-menu'); } else { $('.sticky').removeClass('sticky-menu'); } }); } } Stickymenu(); // Masonry Layout Initialization function masonsary() { var $grid = $(".grid").masonry({ itemSelector: ".grid-item", columnWidth: ".grid-item", gutter: 0, fitWidth: false }); var gridItems = $(".grid-item"); if (gridItems.length > 0) { $grid.imagesLoaded().progress(function () { $grid.masonry("layout"); }); } } masonsary(); })(jQuery);