Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

350
Vistas
How do I change the transition time of an element in JavaScript?

Let's say I have an element with:

.element{
/* some css prorieties */
    transition-duration:1.5s;
    transition-delay:.1s;
}

Now, triggering it by hovering over another element, I want it to come in with this duration and delay, but go out (not hovering anymore) a little faster.

Now let bigobj=the object I hover over

and

let smallobj=the object that transitions (.element)

My JS looks like this:

bigobj.addEventListener('mouseleave',function(){
       smallobj.style.transitionDuration=.3;
       smallobj.style.transitionDelay=.3;
});

It doesn't work.

If I change it to:

smallobj.style.transition="none";

it works as intended.

What would be a fix?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda