1$(document).ready(function () { 2 var header = $('header'); 3 var desktopLogo = $('#desktopLogo'); 4 var mobileLogo = $('#mobileLogo'); 5 var windowWidth = $(window).width(); 6 7 // Handle sticky behavior and logo size 8 function handleStickyHeader() { 9 var scrollTop = $(window).scrollTop(); 10 windowWidth = $(window).width(); 11 12 if (scrollTop > 100) { 13 header.addClass('sticky'); 14 if (windowWidth >= 576) { 15 desktopLogo.css('max-height', windowWidth >= 992 ? '38px' : '35px'); 16 } else { 17 mobileLogo.css('max-height', '25px'); 18 } 19 } else { 20 header.removeClass('sticky'); 21 if (windowWidth >= 576) { 22 desktopLogo.css('max-height', windowWidth >= 992 ? '45px' : '42px'); 23 } else { 24 mobileLogo.css('max-height', '30px'); 25 } 26 } 27 } 28 29 // Initialize 30 handleStickyHeader(); 31 32 // Handle scroll 33 $(window).on('scroll', function () { 34 handleStickyHeader(); 35 }); 36 37 // Handle resize 38 $(window).on('resize', function () { 39 handleStickyHeader(); 40 }); 41 42 // Desktop Hover Behavior 43 if ($(window).width() > 991) { 44 45 var closeTimer; 46 47 // Handle hover on the entire dropdown container 48 $('.navbar-nav .dropdown').hover( 49 function () { 50 // MOUSE ENTER 51 var $dropdown = $(this); 52 53 // Clear any pending close timer 54 if (closeTimer) { 55 clearTimeout(closeTimer); 56 closeTimer = null; 57 } 58 59 // Close all other dropdowns 60 $('.navbar-nav .dropdown').not($dropdown).each(function () { 61 $(this).removeClass('show'); 62 $(this).find('.dropdown-menu, .submenu-content').removeClass('show'); 63 }); 64 65 // Open this dropdown 66 $dropdown.addClass('show'); 67 $dropdown.find('.dropdown-menu, .submenu-content').addClass('show'); 68 }, 69 function () { 70 // MOUSE LEAVE 71 var $dropdown = $(this); 72 73 // Set a timer to close after a short delay 74 closeTimer = setTimeout(function () { 75 $dropdown.removeClass('show'); 76 $dropdown.find('.dropdown-menu, .submenu-content').removeClass('show'); 77 }, 500); 78 } 79 ); 80 81 // Prevent default click on dropdown toggle links 82 $('.navbar-nav .dropdown > .nav-link').on('click', function (e) { 83 var href = $(this).attr('href'); 84 if (!href || href === '#' || href === '') { 85 e.preventDefault(); 86 } 87 }); 88 89 } else { 90 // Mobile/Tablet Behavior 91 $('.navbar-nav .dropdown > .nav-link').on('click', function (e) { 92 e.preventDefault(); 93 var $dropdown = $(this).closest('.dropdown'); 94 95 // Close other dropdowns 96 $('.navbar-nav .dropdown').not($dropdown).each(function () { 97 $(this).removeClass('show'); 98 $(this).find('.dropdown-menu, .submenu-content').removeClass('show'); 99 }); 100 101 // Toggle current dropdown 102 $dropdown.toggleClass('show'); 103 $dropdown.find('.dropdown-menu, .submenu-content').toggleClass('show'); 104 }); 105 106 // Close dropdown when clicking outside 107 $(document).on('click', function (e) { 108 if (!$(e.target).closest('.navbar-nav .dropdown').length) { 109 $('.navbar-nav .dropdown').removeClass('show'); 110 $('.navbar-nav .dropdown-menu, .submenu-content').removeClass('show'); 111 } 112 }); 113 } 114});
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.