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

147
Visualizações
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 à 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