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

446
Views
¿Por qué el efecto 'duración de la transición' no funciona en el posicionamiento 'justificar contenido' o 'izquierda, derecha'?

 let ball, startEnd; function startCal() { //variables ball = document.getElementById('ball'); startEnd = document.getElementById('start-end'); startEnd.style.justifyContent = "flex-end"; // the background color of the ball is will be rgb(33 250 18) ball.style.backgroundColor = "#0ee71f "; // the new value of onclick attribute of start-end button // is will be endCal() func startEnd.setAttribute('onclick', 'endCal()'); } function endCal() { //variables ball = document.getElementById('ball'); startEnd = document.getElementById('start-end'); startEnd.style.justifyContent = "flex-start"; // the background color of the ball is will be red ball.style.backgroundColor = "red"; // the new value of onclick attribute is will be startCal() startEnd = document.getElementById('start-end'); startEnd.setAttribute('onclick', 'startCal()'); }
 .oc { width: 385px; height: 30px; display: flex; justify-content: flex-end; } #start-end { display: flex; justify-content: flex-start; align-items: center; height: 30px; width: 65px; background: black; cursor: pointer; border-radius: 250px; } #ball { /* left: 0; display: block; */ transition-duration: 2s; width: 25px; height: 25px; background: red; border-radius: 100%; }
 <div class="oc"> <div id="start-end" onclick="startCal()"> <div id="ball" class="open"></div> </div> </div>

Quiero que la pelota pase lentamente, pero el efecto solo funciona en el cambio de color. ¿Por qué? ¿No se puede usar en eventos de transición? También probé los valores derecho e izquierdo, pero no funcionó. Alguien dijo que estableciera un valor predeterminado para el valor de la izquierda como 'izquierda: 0', pero en ese caso solo cambió el color.

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