PageSourceSearch

https://memoriahistorica.org.es/wp-content/themes/twentytwelve-child/js/menu-desktop.js?ver=1.0

js memoriahistorica.org.es collected 2026-10-01 12:18:47 UTC 1,568 bytes, 47 lines download raw bytes

1document.addEventListener("DOMContentLoaded", function() {
2    // Selecciona todos los items que tienen submenú
3    const menuItems = document.querySelectorAll(".main-navigation .nav-menu li.menu-item-has-children");
4
5    menuItems.forEach(item => {
6        const link = item.querySelector("a");
7        const submenu = item.querySelector("ul.sub-menu");
8
9        // Oculta submenú inicialmente
10        submenu.style.display = "none";
11
12        // Función para mostrar
13        const showSubmenu = () => {
14            submenu.style.display = "block";
15            submenu.style.opacity = "1";
16            submenu.style.transition = "opacity 0.3s ease-in-out";
17        };
18
19        // Función para ocultar
20        const hideSubmenu = () => {
21            submenu.style.opacity = "0";
22            setTimeout(() => {
23                submenu.style.display = "none";
24            }, 300);
25        };
26
27        // Hover en escritorio (≥769px)
28        item.addEventListener("mouseenter", () => {
29            if(window.innerWidth > 768) showSubmenu();
30        });
31        item.addEventListener("mouseleave", () => {
32            if(window.innerWidth > 768) hideSubmenu();
33        });
34
35        // Click en móvil (≤768px) para alternar submenú
36        link.addEventListener("click", e => {
37            if(window.innerWidth <= 768) {
38                e.preventDefault();
39                if(submenu.style.display === "block") {
40                    hideSubmenu();
41                } else {
42                    showSubmenu();
43                }
44            }
45        });
46    });
47});

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.