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

155
Views
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
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!