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

129
Vistas
How to add multiple css proerty in jquery

I am using jquery to add css to a div, it works well when I add just one css property

here is the code;

jQuery(window).on('scroll', function() {
    if(jQuery(window).scrollTop() > 60) {
        jQuery('#myheader2').css('background-color', '#fff');
    } else {
       jQuery('#myheader2').css('background-color', '#fff');
    }
});

However if add more than one css property, it stops working;

here is the code;

jQuery(window).on('scroll', function() {
    if(jQuery(window).scrollTop() > 60) {
        jQuery('#myheader2').css({'background-color': '#fff','transition': 'background-color 3s';});
    } else {
       jQuery('#myheader2').css('background-color', '#0b0b22');
    }
});

I looking to add transition to slow the speeed of background color change.

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