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

121
Views
agregue un ícono de triángulo a la apertura y cierre de div

Tengo el código donde al hacer clic en el enlace, estoy abriendo y cerrando el div

aquí está el código

 <div id="opendialog" style="display:none;"> <div style="width:100%;height:200px;background:grey;"></div> </div>

la función

 function openx() { var x= document.getElementById("opendialog"); if (x.style.display === "none") { x.style.display = "block"; } else { x.style.display = "none"; } }

funciona bien, pero ¿cómo puedo agregar un triángulo al enlace cuando se hace clic? Debe mostrar un triángulo al div, tratando de que si la pantalla es pequeña o más grande, el triángulo se debe colocar correctamente debajo del enlace cuando se hace clic y debe no ser un problema

aqui esta el html que tengo

 <div onclick="openx()">+ Add <div>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede usar el ícono de fuente increíble para el triángulo hacia arriba y hacia abajo. Solo necesita agregar y eliminar la clase en consecuencia.

 function openx() { var x= document.getElementById("opendialog"); if (x.style.display === "none") { x.style.display = "block"; document.getElementById("myIcon").innerHTML = "➖"; } else { document.getElementById("myIcon").innerHTML = "➕"; x.style.display = "none"; } }
 #myIcon { margin-bottom: 3px; font-size: 20px; font-weight: bolder; } #myIcon:hover { cursor: pointer; }
 <div onclick="openx()"><div id="myIcon">➕</div><div> <div id="opendialog" style="display:none;"> <div style="width:100%;height:200px;background:grey;"></div> </div>

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!