(function ($) { "use strict"; /* mPLyr Audio * ------------------------------------------------------ */ const player = new Plyr('#player'); // Main Menu Offcanvas $('.primary-menu').find('li a').each(function () { if ($(this).next().length > 0) { $(this).parent('li').append(''); } }); // expands the dropdown menu on each click $('.primary-menu').find('li .menu-trigger').on('click', function (e) { e.preventDefault(); $(this).toggleClass('open').parent('li').children('ul').stop(true, true).slideToggle(350); $(this).find("i").toggleClass("fa-angle-up fa-angle-down"); }); // check browser width in real-time function breakpointCheck() { var windoWidth = window.innerWidth; if (windoWidth <= 991) { $('.header-navbar').addClass('mobile-menu'); } else { $('.header-navbar').removeClass('mobile-menu'); } } breakpointCheck(); $(window).on('resize', function () { breakpointCheck(); }); $('.nav-toggler').on('click', function (e) { $('.site-navbar').toggleClass('menu-on'); e.preventDefault(); }); // Close menu on toggler click $('.nav-close').on('click', function (e) { $('.site-navbar').removeClass('menu-on'); e.preventDefault(); }); document.addEventListener('DOMContentLoaded', function () { const submenuParents = document.querySelectorAll('.primary-menu'); submenuParents.forEach((parent) => { parent.addEventListener('keydown', function (e) { if (e.key === 'Enter' || e.key === ' ') { // Toggle the submenu visibility when Enter or Space is pressed const submenu = parent.querySelector('.sub-menu'); if (submenu) { submenu.style.display = submenu.style.display === 'block' ? 'none' : 'block'; } e.preventDefault(); } }); }); }); // Offcanvas Info menu $('.offcanvas-icon').on('click', function (e) { $('.offcanvas-info').toggleClass('offcanvas-on'); e.preventDefault(); }); // Close menu on toggler click $('.info-close').on('click', function (e) { $('.offcanvas-info').removeClass('offcanvas-on'); e.preventDefault(); }); /* ----------------------------------------------------------- */ /* Fixed header /* ----------------------------------------------------------- */ $(window).scroll(function () { var window_top = $(window).scrollTop() + 1; if (window_top > 50) { $('.navbar-sticky').addClass('menu_fixed header-white animated fadeInDown'); } else { $('.navbar-sticky').removeClass('menu_fixed header-white animated fadeInDown'); } }); /* --------------------------------------------- Sticky Fixed Menu --------------------------------------------- */ $(window).scroll(function () { var window_top = $(window).scrollTop() + 1; if (window_top > 50) { $('.fixed-btm-top').addClass('reveal'); } else { $('.fixed-btm-top').removeClass('reveal'); } }); /* --------------------------------------------- Bottom To Top hide --------------------------------------------- */ $(window).scroll(function () { var window_top = $(window).scrollTop() + 1; if (window_top > 50) { $('.fixed-btm-top').addClass('reveal'); } else { $('.fixed-btm-top').removeClass('reveal'); } }); // POSt Gallery slider $('.post-gallery-slider').slick({ dots: false, arrows: true, infinite: true, autoplay: true, speed: 300, slidesToShow: 1, slidesToScroll: 1, responsive: [ { breakpoint: 1024, settings: { slidesToShow: 1, slidesToScroll: 1, infinite: true, dots: true } }, { breakpoint: 768, settings: { slidesToShow: 1, slidesToScroll: 1 } }, { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1 } } ] }); // Lightbox $('.popup').magnificPopup({ type: 'image', gallery:{ enabled:true }, removalDelay: 300, }); }(jQuery));