Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

98
Visualizações
Jquery IMG Attr change keeps flickering while scrolling

I have a white menu icon in PNG format that I want to change to green menu icon in PNG format and I tried to use the fading effect. It works at first and changes on scroll but when I keep scrolling it keeps flickering the green icon, however it stops when I stop scrolling as well. I'm not sure why this is happening or how can I fix it, couldn't really find the related questions. I'd appreciate your help. Thanks in advance here is my code:

      $(window).scroll(function() {
          var scroll = $(window).scrollTop();

          if (scroll >= 50) {
            $(".show_nav img").fadeOut(function() {
              $(this).attr("src","../img/icons/menu-green.png").fadeIn();
            });

          } else {
            $(".show_nav img").fadeOut(function() {
              $(this).attr("src","../img/icons/menu-white.png").fadeIn();
            });
          }
      });
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda