1/** 2 * Dropdown Menu JavaScript 3 * Handles mobile menu toggle and submenu interactions 4 */ 5 6(function($) { 7 'use strict'; 8 9 $(document).ready(function() { 10 11 // Mobile menu toggle 12 $('.toggleMenu').on('click', function(e) { 13 e.preventDefault(); 14 $('.nav').toggleClass('active'); 15 $(this).toggleClass('active'); 16 }); 17 18 // Mobile submenu toggle 19 if ($(window).width() <= 768) { 20 $('.nav .menu-item-has-children > a').on('click', function(e) { 21 e.preventDefault(); 22 var $parent = $(this).parent(); 23 24 // Close other open submenus at the same level 25 $parent.siblings('.menu-open').removeClass('menu-open'); 26 27 // Toggle current submenu 28 $parent.toggleClass('menu-open'); 29 }); 30 } 31 32 // Desktop hover enhancement (optional, CSS handles most of it) 33 if ($(window).width() > 768) { 34 $('.nav li').hover( 35 function() { 36 $(this).addClass('hover'); 37 $(this).children('ul.sub-menu').stop(true, true).fadeIn(200); 38 }, 39 function() { 40 $(this).removeClass('hover'); 41 $(this).children('ul.sub-menu').stop(true, true).fadeOut(200); 42 } 43 ); 44 } 45 46 // Close mobile menu when clicking outside 47 $(document).on('click', function(e) { 48 if (!$(e.target).closest('.header').length) { 49 $('.nav').removeClass('active'); 50 $('.toggleMenu').removeClass('active'); 51 } 52 }); 53 54 // Handle window resize 55 var resizeTimer; 56 $(window).on('resize', function() { 57 clearTimeout(resizeTimer); 58 resizeTimer = setTimeout(function() { 59 if ($(window).width() > 768) { 60 $('.nav').removeClass('active'); 61 $('.toggleMenu').removeClass('active'); 62 $('.menu-open').removeClass('menu-open'); 63 } 64 }, 250); 65 }); 66 67 // Keyboard accessibility for dropdown menus 68 $('.nav a').on('focus', function() { 69 $(this).parents('li').addClass('focus'); 70 }).on('blur', function() { 71 $(this).parents('li').removeClass('focus'); 72 }); 73 74 }); 75 76})(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.