Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

190
Vistas
How can I fix links that don't work in a minimized menu?

I have a pretty typical menu where the top items have children that fly out when you roll over. Works great above 992px. Below 992, you're supposed to click/tap the top item to get the flyout. That works fine, you get the pointer and even the file name in the link preview. But when you click/tap, it just stays on the same page and the flyout collapses. The only thing I can find is the statement below in javascript. If you delete it, the flyouts don't work at all. If you delete && e.preventDefault(), the top links work but the flyout doesn't happen.

document.addEventListener("click",function(e){
   e.target.closest(".menu-item-has-children") && window.innerWidth <= 992 && e.preventDefault()
})

https://dmvnv.com/2021/

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Found the answer.

The preventDefault is passed on from the parent to the children (like the bad genes that left you cross-eyed).

You need to stop the propagation. In this case, the children are list items in a second unordered list with a class of sub-menu.

    $('.sub-menu').on("click", function(e){
        e.preventDefault();
     }).children().click(function(e) { // catch all children click
        e.stopPropagation();
     });

Javascript, Stop preventDefault() to pass to child element

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda