1$(document).ready(function(){ 2 3 // --- Toggle submenú (solo en móvil ⤠900px) --- 4 $('.menuPrincipalCabecera > label').on('click', function(event){ 5 var anchoVentana = $(window).innerWidth(); 6 if(anchoVentana > 900) return true; 7 var $obj = $(this); 8 var $li = $(this).closest('.menuPrincipalCabecera'); 9 var submenu = $li.find('ul.header-submenuContenedo'); 10 var eraVisible = submenu.is(':visible'); 11 $('ul.header-submenuContenedo').hide(); 12 $('#unicode').html('▽'); 13 $('li.menuPrincipalCabecera.tmpActive').removeClass('tmpActive'); 14 if(submenu.length == 0) return true; 15 event.preventDefault(); 16 if(eraVisible) { 17 $li.removeClass('tmpActive'); 18 submenu.hide(); 19 } else { 20 $li.addClass('tmpActive'); 21 submenu.css('display', 'flex'); 22 $('#unicode').html('△'); 23 } 24 }); 25 26 // --- Toggle menú "Menu" (solo en móvil ⤠900px) --- 27 $('.header-menu').on('click', function(event){ 28 if(event.target !== this) return true; 29 $obj = $(this); 30 var anchoVentana = $(window).innerWidth(); 31 if(anchoVentana > 900) return true; 32 if(!$obj.hasClass('header-menu')) return true; 33 $obj.toggleClass('xvisible'); 34 }); 35 36 // --- Detección de desbordamiento del nav (> 1299px) --- 37 // Solo aplica a modulo-cabecera-2, donde el nav tiene max-width restringido 38 // (calc(100vw - 544px)) y las pestañas pueden desbordarse. 39 // modulo-cabecera-1 no necesita esto: su nav ocupa todo el ancho disponible 40 // y el wrap natural acomoda las pestañas sin problemas. 41 function checkNavOverflow() { 42 var header = document.getElementById('modulo-cabecera-2'); 43 if (!header) return; 44 45 var anchoVentana = window.innerWidth; 46 // ⤠1299px: el media query CSS ya expande las pestañas a ancho completo 47 // ⤠900px: el colapso "Menu" maneja todo 48 if (anchoVentana <= 1299) { 49 header.classList.remove('nav-overflow'); 50 return; 51 } 52 53 var nav = header.querySelector('#header-bloquemenu nav.header-menu'); 54 if (!nav) return; 55 var ul = nav.querySelector('ul'); 56 if (!ul) return; 57 58 // Quitar la clase para medir en estado restringido (max-width original) 59 header.classList.remove('nav-overflow'); 60 void ul.offsetHeight; // Forzar recálculo de layout 61 62 // Comprobar si las pestañas hacen wrap (scrollHeight > 1.5à una lÃnea) 63 // Usamos scrollHeight porque el nav tiene height fija (32px) que 64 // restringe offsetHeight aunque las pestañas desborden a 2+ filas. 65 var firstItem = ul.children[0]; 66 if (!firstItem) return; 67 var lineHeight = firstItem.offsetHeight; 68 var hasOverflow = ul.scrollHeight > lineHeight * 1.5; 69 70 if (hasOverflow) { 71 header.classList.add('nav-overflow'); 72 } 73 } 74 75 var resizeTimer; 76 checkNavOverflow(); 77 $(window).on('resize', function() { 78 clearTimeout(resizeTimer); 79 resizeTimer = setTimeout(checkNavOverflow, 150); 80 }); 81 82});
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.