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

162
Vistas
No Apply Animate CSS library effect to element

I have a doubt when using the Animate CSS library I can apply it only once but I want it to apply another output effect when I click on the icon and that's where I don't get it.

const tocar = document.getElementsByClassName("tocar")[0];
const btn = document.getElementById("mostrar")
const cerrar = document.querySelector(".cerrar")


function mostrar(){
  tocar.addEventListener("click",e=>{
    btn.style.display="block";
  
  })
}

function  close(){
  cerrar.addEventListener("click", e =>{
   btn.classList.add('animate__animated', 'animate__fadeOutDown')
   btn.style.display="none"
  })
  }

mostrar()
close()
#mostrar{
display:none;
}
<!DOCTYPE html>
<html lang="es">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Jan Kelly | A Creative Digital Agency</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"/>
  <link rel="stylesheet" href="/css/style.css">
    <script src="iconosPro.js"></script>
</head>
<body>

   <div class="container-video ">
            <span class="tocar">toca aquí </span>
            <p id="mostrar" class="animate__animated animate__zoomInDown">Hola mundo</p>
            <br>
            <span class="cerrar">cerrar</span> 
      </div>
</body>

</html>

So if you realize the closure doesn't do the animation for me, it's supposed to call the selector and apply the new class to it but it doesn't work. can you help me please?

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