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

163
Views
¿Cómo puedo convertir mi menú de hamburguesas en una cruz?

Me gustaría que cuando hacemos clic en mi menú se convierta en una cruz, no entiendo por qué no funciona. Lo que seria bueno es poder lanzar una animacion cuando otra termina en css

El objetivo de la animación es que los tramos superior e inferior desaparezcan y los dos tramos pequeños del medio crezcan y giren 45 grados.

Gracias por su ayuda, aquí está mi código en codepen a continuación

https://codepen.io/JulienMtau/pen/abOBREK

 .icon-menu { cursor: pointer; width: 30px; height: 24px; position: relative; & > span:first-child { transition: width 0.2s; position: absolute; top: 50%; background: black; width: 40%; height: 1px; } & > span:last-child { transition: width 0.2s, transform 0.2s; position: absolute; top: 50%; transform: translateX(150%); background: black; width: 40%; height: 1px; } & > span:nth-of-type(2) { transition: width 0.2s, margin-left 0.2s; position: absolute; top: 50%; width: 100%; &::before, &::after { content: ""; position: absolute; width: 100%; height: 1px; background: black; } &::before { transform: translateY(-7px); } &::after { transform: translateY(7px); } } .active:first-of-type { animation: burgerToCrossForFirst 1s; } .active:nth-of-type(2) { transition: width 0.2s, margin-left 0.2s; width: 0%; margin-left: 50%; } .active:last-of-type { animation: burgerToCrossForLast 0.2s; } } @keyframes burgerToCrossForFirst { 0% { width: 50%; } 50% { width: 100%; } 100% { transform: rotate(45deg); } } @keyframes burgerToCrossForLast { 0% { width: 50%; transform: translateX(100%); } 50% { width: 100%; transform: translateX(0%); } 100% { transform: translateX(0%) rotate(-45deg); } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

 $('.btn').click(function () { $(this).toggleClass("click"); });
 .btn { position: absolute; top: 15px; left: 45px; height: 45px; width: 45px; text-align: center; background: #1b1b1b; border-radius: 3px; cursor: pointer; } .btn span { color: white; font-size: 28px; line-height: 45px; } .btn.click span:before { content: '\f00d'; /* cross icon */ }
 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="style.css"> <script src="https://code.jquery.com/jquery-3.4.1.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" /> </head> <body> <div class="btn"> <span class="fas fa-bars"></span> </div> </body> </html>

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!