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

200
Views
El código CSS/JavaScript funciona cuando se implementa, pero cuando actualizo la página no funciona

Estoy usando el widget HTML para Elementor, un creador de temas de Wordpress. Estoy tratando de mostrar/ocultar secciones ( sect1 - sect12 llamado HTML , CSS , Javascript y Node ) cuando hago clic en ciertos botones ( btn1, btn2, btn3 , llamado Frontend Developer , Backend Developer y Designer ), y lo hice funcionar , pero cuando actualizo la página, no se puede hacer clic en los botones. Cada botón controla 4 secciones, por lo que btn1 -> sect1 - sect4 , btn2 -> sect5 - sect8 , btn3 -> sect9 - sect 12 .

 <script> .elementor-editor-active .hidden{ display:block; } .hidden{ display:none; } .shown{ display: block !important; animation: fade_in_anim 0.5s; } .btn_active_state{ background-color: #D9D3FF !important; } @keyframes fade_in_anim { 0% { opacity: 0; transform: translateY(-30px); } 100% { opacity: 1; transform: translateY(0px); } } const buttons = [...document.querySelectorAll("[id^='btn']")] const mapping = [[0, 4], [4, 8], [8,12]] const sections = [...document.querySelectorAll("[id^='sect']")] for(let i = 0; i < 3; i++) { buttons[i].addEventListener('click', function(event) { event.preventDefault(); toggleDivs(this) for(let j = mapping[i][0]; j < mapping[i][1]; j++) { sections[j].classList.add("shown", "fade") } }) } function toggleDivs(btn){ buttons.forEach(b => b.classList.remove("btn_active_state")) btn.classList.add("btn_active_state") sections.forEach(s => s.classList.remove('shown')) } //force button1 state initialise, if required btn1.focus(); btn1.click(); </script> <style> .elementor-editor-active .hidden{ display:block; } .hidden{ display:none; } .shown{ display: block !important; animation: fade_in_anim 0.5s; } .btn_active_state{ background-color: #D9D3FF !important; } @keyframes fade_in_anim { 0% { opacity: 0; transform: translateY(-30px); } 100% { opacity: 1; transform: translateY(0px); } } </style>

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

¿Estás tratando de hacer un menú de acordeón?

Puedes mostrar-ocultar con disparador

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!