Santo Domingo 23°C/26°C thunderstorm with rain

Listin Diario El Lístin diario

Suscribete
//BOTON TEMPORAL FLIPPAY document.addEventListener("DOMContentLoaded", function () { // Esperar a que el DOM esté completamente cargado let boton = document.querySelector(".c-header__user"); // Selecciona el botón por su clase boton.removeAttribute("onclick"); // Elimina el atributo onclick if (boton) { boton.addEventListener("click", function (event) { event.preventDefault(); // Evita que el botón abra el enlace original event.stopPropagation(); // Evita que se cierre el menú inmediatamente toggleDropdown(); }); // Crear y agregar el menú dropdown dinámicamente let dropdown = document.createElement("div"); dropdown.classList.add("dropdown-content"); dropdown.style.position = "absolute"; dropdown.style.backgroundColor = "white"; dropdown.style.minWidth = "160px"; dropdown.style.boxShadow = "0px 8px 16px rgba(0,0,0,0.2)"; dropdown.style.zIndex = "1000"; dropdown.style.borderRadius = "5px"; dropdown.style.display = "none"; dropdown.style.overflow = "hidden"; let opciones = [ { texto: "Registrarme", url: "#", cssclass: "fp-sign-in"}, { texto: "Cerrar Sessión", url: "#", cssclass: "fp-sign-out" }, { texto: "Mi Cuenta", url: "#", cssclass: "fp-member-center" } ]; opciones.forEach(opcion => { let enlace = document.createElement("a"); dropdown.classList.add("dropdown-content"); enlace.href = opcion.url; enlace.classList.add(opcion.cssclass); enlace.textContent = opcion.texto; enlace.style.color = "black"; enlace.style.padding = "10px 15px"; enlace.style.display = "block"; enlace.style.textDecoration = "none"; enlace.style.transition = "background 0.3s"; enlace.addEventListener("mouseover", function () { enlace.style.backgroundColor = "#f1f1f1"; }); enlace.addEventListener("mouseout", function () { enlace.style.backgroundColor = "white"; }); dropdown.appendChild(enlace); }); // Agregar el menú al documento document.body.appendChild(dropdown); function toggleDropdown() { let rect = boton.getBoundingClientRect(); dropdown.style.top = rect.bottom + "px"; dropdown.style.left = rect.left + "px"; dropdown.style.display = dropdown.style.display === "block" ? "none" : "block"; } // Cerrar el menú si se hace clic fuera document.addEventListener("click", function (event) { if (!dropdown.contains(event.target) && event.target !== boton) { dropdown.style.display = "none"; } }); } });