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

227
Vistas
Click event doesn't work in the first click, why?

I am trying to make an accordion menu. I am comparing the height property to open and close the menu. But in the first click it doesn't work, it works well after the second, third click. To me, my algorithm made sense. But often I get results that I didn't expect.

let portfolio_button = document.getElementById('portfolio--button');
let portfolio_menu = document.getElementById('portfolio--menu');
let i = 0;
let mobile_menu = document.getElementById('mobile--menu');
let mobile_menu_icon = document.getElementById('mobile--menu--icon');





function portfolioMenu(){
   if(portfolio_menu.style.height === "0px"){
       portfolio_menu.style.height = "100px";
       mobile_menu.style.height = "370px";
   }
   else{
       portfolio_menu.style.height = 0;
       mobile_menu.style.height = "270px";
   }
}

function openMobileMenu() {
   if (mobile_menu.style.height === "
about 4 years ago · Juan Pablo Isaza
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