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

95
Visualizações
Making a code to disable a css of a tag and enable the css on an other tag

I'm making a website and I want to make a guide with pulse animation. There are 3 tags that I want to use. For example three <a> links, I want:

  • first link starts pulsing and when I clicked on it its css be disabled and
  • the second link starts pulsing, and
  • a third one like this

I think it may be possible with javascript but I dont know how.

For example:

   #live-heart{
    animation:pulse 1500ms infinite ;
    border-radius:20px;
   }
   @keyframes pulse{
     0% {
       box-shadow:#f33 0 0 0 0;
     }
     75%{
       box-shadow:rgba(65, 30, 30, 0.8) 0 0 0 16px
     }
   }
      #live-heart2{
    animation:pulse 1500ms infinite ;
    border-radius:20px;
   }
   @keyframes pulse{
     0% {
       box-shadow:#f33 0 0 0 0;
     }
     75%{
       box-shadow:rgba(65, 30, 30, 0.8) 0 0 0 16px
     }
   }
      #live-heart3{
    animation:pulse 1500ms infinite ;
    border-radius:20px;
   }
   @keyframes pulse{
     0% {
       box-shadow:#f33 0 0 0 0;
     }
     75%{
       box-shadow:rgba(65, 30, 30, 0.8) 0 0 0 16px
     }
   }   
<a href="#" id="live-heart2">first one</a>
<p>
When a user clicked on "first one" its css shoul be disabled and a second one that I linked in paragraph be enabled <a href="#" id="live-heart">second one</a>
and when a user clicked on second one, its css be disabled and the third one be activeted
example text: bla bla bla bla
</p>
<a href="#" id="live-heart3">third one</a>

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

basically all you need is to having a state holding the active pulsing link index. and by clicking it, increase the index by one.

something like that:

const [isPulsingIndex, setIsPulsingIndex] = useState(0);

<Link className={isPulsing.index === 0 ? 'pulsing' : ''} 
  onClick={() => setIsPulsingIndex(1)}>
    Link 1
</Link>
<Link className={isPulsing.index === 1 ? 'pulsing' : ''} 
  onClick={() => setIsPulsingIndex(2)}>
    Link 1
</Link>
<Link className={isPulsing.index === 2 ? 'pulsing' : ''} 
  onClick={() => setIsPulsingIndex(3)}>
    Link 1
</Link>

quick example of how adding and removing class from a tag dynamically using state

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