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

99
Vistas
I want to change image 1 to image 2 if it's clicked then return to image 1 automatically after 1 second

When the image is clicked, I want it to change to another image and get pushed to the top

After it's clicked and image 2 appears it returns back to image 1 and get pushed back to the bottom

this is my code so far

function marioAnimation() {
  var i = true;
  var image = document.getElementById("mario1");
  if (i) {
    document.getElementById("mario1").src = "/mario2.png";
    image.style.marginTop = '10px';
    var x = false;
  } else {
    document.getElementById("mario1").src = "/mario1.png";
  }
}
<section id="section1">
  <div class="container">
    <img class="image" src="/mario1.png" alt="" id="mario1" onclick="marioAnimation()" style="margin-top: 50px;">

  </div>
</section>

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