Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

178
Views
¿Cómo agregar transiciones a un menú desplegable?

Tengo un menú desplegable que hace que aparezca texto cuando se hace clic. Sin embargo, cuando le agrego transiciones, no pasa nada. Todavía aparece sin deslizarse hacia abajo. Quiero que la transición muestre el texto gradualmente de arriba a abajo tal como aparece.

Este es el CSS:

 .drop-down { display: flex; flex-direction: column; text-align: left; transition: height 0.3s ease-in-out; transition-delay: 0.1s; overflow: hidden; position: relative; }

.menu es el nombre de la clase del botón en el que se hizo clic y que muestra este texto .drop-down .

No sé si usé la transition correctamente.

¿Debería haber usado JavaScript en su lugar? y si no que tengo que cambiar?

Código JavaScript:

 const menu = document.querySelector('.menu') const menuContent = document.querySelector('.drop-down') menu.addEventListener('click', menuClick, false); menuContent.style.display = 'none' function menuClick() { menuContent.classList.toggle('show'); if (menuContent.style.display == 'none') { menuContent.style.display = 'block' } else { menuContent.style.display = 'none' } }
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Puedes hacer esto sin javascript.

 .drop-down { display: flex; flex-direction: column; text-align: left; transition: height 0.3s ease-in-out; transition-delay: 0.1s; overflow: hidden; position: relative; opacity:0; visibility:hidden; } .menu:hover .drop-down{ opacity:1; visibility:visible; }

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!