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

135
Views
dropdown menu not closing

i have a dropdown menu that is not closing after opening,

when i click on it , it opens , but after the second click it doesn't close

 function menuFunction(){
    var menu = document.getElementById('ani-menu');

   if(menu.style.zIndex = "-1"){
     menu.style.visibility = "visible"
     menu.style.transform = "translateY(0)"
     menu.style.opacity = "1"
     menu.style.zIndex = "1"
     
   }
   else{
    menu.style.visibility = "hidden"
     menu.style.transform = "translateY(-3em)"
     menu.style.opacity = "0"
     menu.style.zIndex = "-1"
   }

  }  


 <li class="menu-btn1" onclick="menuFunction()"><a class="services" href="#ICT">Services<i class="fas fa-arrow-down"></i></a>
<ul class="ani-menu" id="ani-menu">
  <li><a href="#ICT">ICT Solutions</a></li>
  <li><a href="#One-On-One">Trainings</a></li>
  <li><a href="#materials">Materials</a></li>
  <li><a href="#packs">Exclusive Offers</a></li>
</ul>
</li>  
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The Problem is = in this line if(menu.style.zIndex = "-1"). Use instead ==. then will work.

about 4 years ago · Juan Pablo Isaza 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!