1// script para provocar el despliegue en opciones padre de nivel 0 en el meu vista movil, y evita la propagación del evento click a los hijos 2// se carga en el footer de la plantilla 3jQuery(document).ready(function($) { 4 5 function setupMobileMenu() { 6 if (window.matchMedia('(max-width: 767px)').matches) { 7 8 // SELECTOR CORREGIDO Y MUY ESPECÃFICO 9 // Usa '>' para seleccionar solo los hijos directos (NIVEL 0) 10 var menuItems = $('#Top_bar .menu_wrapper > #menu > ul.menu-main > li.menu-item-has-children > a:first-of-type'); 11 12 menuItems.each(function() { 13 var href = $(this).attr('href'); 14 if ((!href || href === '#') && $(this).parent().find('span.menu-parent-item').length === 0) { 15 var text = $(this).text(); 16 $(this).replaceWith('<span class="menu-parent-item">' + text + 'â¼</span>'); 17 } 18 }); 19 } 20 } 21 22 setupMobileMenu(); 23 $(window).on('resize', setupMobileMenu); 24 25 // El manejador de clicks ya es correcto, no necesita cambios. 26 $(document).on('click', '#Top_bar .menu_wrapper > #menu > ul.menu-main > li.menu-item-has-children > span.menu-parent-item', function(e) { 27 var subMenu = $(this).siblings('ul.sub-menu'); 28 subMenu.slideToggle(200); 29 $(this).parent().toggleClass('submenu-open'); 30 }); 31 32}); 33///ultimo script que funcionaba//////////////////////// 34// jQuery(document).ready(function($) { 35 36// function setupMobileMenu() { 37// if (window.matchMedia('(max-width: 767px)').matches) { 38// console.log('ð¢ Script de menú móvil ACTIVO'); 39 40// // Selector especifico para nuestra estructura de menú. 41// var menuItems = $('#Top_bar .menu_wrapper li.menu-item-has-children > a'); 42 43// menuItems.each(function() { 44// var href = $(this).attr('href'); 45// if ((!href || href === '#') && $(this).parent().find('span.menu-parent-item').length === 0) { 46// var text = $(this).text(); 47// // Evitamos que el enlace se convierta en un enlace vacÃo, aprovechamos y cambiamos la flecha 48// $(this).replaceWith('<span class="menu-parent-item">' + text + 'â¼</span>'); 49// } 50// }); 51// } else { 52// console.log('ð´ Script de menú móvil INACTIVO (vista escritorio)'); 53// } 54// } 55 56// setupMobileMenu(); 57// $(window).on('resize', setupMobileMenu); 58 59// // LISTENER para el clic en los elementos del menú padre 60// $(document).on('click', '#Top_bar .menu_wrapper li.menu-item-has-children > span.menu-parent-item', function(e) { 61// console.log('ð Click en:', $(this).text()); 62// var subMenu = $(this).siblings('ul.sub-menu'); 63// console.log('ð© Desplegando submenú MANUAL'); 64// subMenu.slideToggle(200); 65// $(this).parent().toggleClass('submenu-open'); 66// }); 67 68// });
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.