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

80
Views
Cerrar el menú cuando el usuario hace clic en div

¿Cómo puedo verificar si un usuario está haciendo clic en un div llamado contenedor del lado derecho y si elimina la clase de menú abierto?

 toggleMenu() { this.open = !this.open; document.getElementsByTagName("html")[0].classList.toggle("menu-opened"); if (this.open) { document.addEventListener("click", this.menuClickListener); } else { document.removeEventListener("click", this.menuClickListener); } }, menuClickListener($event) { console.log($event); }, }, }; // This is what I want to remove when the user is clicking the right-side-container document.getElementsByTagName("html")[0].classList.remove("menu-opened");
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Supongo que desea abrir/cerrar el menú al hacer clic. Entonces puedes hacer esto en Vue:

 export default { data() { return { show: true } }, methods: { toggle() { // my different actions... this.show = !this.show } } }
 <div v-if="show"> My menu </div> <div @click="toggleMenu"> Your button/container to show/hide menu </div>

Aquí adjuntas tu variable "mostrar" para mostrar o no el elemento que quieres. Y adjunta su función de "clic" al elemento en el que desea hacer clic para mostrar/ocultar su elemento.

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!