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

154
Vistas
Toggle Menu when closed not change icon

I have a toggle menu

     <button class="menu"
              onclick="menu(this),this.classList.toggle('opened');this.setAttribute('aria-expanded', this.classList.contains('opened'))">

And I apply css if it is opened

Where menu:

function menu(event) {
    if($(event).hasClass('active')) {
        $(event).removeClass('active');
    } else {
        $(event).addClass('active');
    }
}

This works, so If I click on menu it is opened and I change the icon , and if I click another time the menu is closed and the icon returns as at the beginning.

My problem is if I click on the menu, it change the icon, but If I don't click another time in the menu but in another page, the icon remains equals.

So for example

MENU: with Icon1

I click on menu Icon1->Icon2. I close menu Icon2->Icon1

I click on menu Icon1->Icon2 If I click in another part (for example in another page) the menu is closed but Icon is Icon2

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