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

117
Vistas
My multiple logo change on scroll fails at the second 'else if'

I'm trying to change a logo depending on which section it passes through --light logo on dark section and vice versa-- by using the jQuery scrollTop. The first rule executes correctly, the logo changes after 450, but the second rule doesn't execute at 470, which is odd since the else works fine. The logo changes back to its original state. Here's my WP JS snippet:

jQuery(document).on('scroll', function() {
    if (jQuery(this).scrollTop() > 450) {
        jQuery('.navbar-brand img').attr('src','http://localhost/site/wp-content/uploads/2021/09/mini-logo.png');
    } else if (jQuery(this).scrollTop() > 470) {
        console.log("it works");
        jQuery('.navbar-brand img').attr('src','http://localhost/site/wp-content/uploads/2021/09/dark-f-logo.png');
    } else {
        jQuery('.navbar-brand img').attr('src','http://localhost/site/wp-content/uploads/2021/09/dark-f-logo.png');
    }
});

Thanks for taking a look.

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