Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

187
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda