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

395
Vistas
How can you delay an <a> link from loading until after the element animates out of the viewport?

I styled some elements with :active and :hover pseudo-selectors, including a "button press" type animation that also triggers animations that slide the elements out of the viewport.

I'm trying to make a really smooth UX and want to delay the hyperlinked content from loading until after these animations finish.

How can you accomplish this load delay with HTML/CSS/JS?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Use the JavaScript setTimeout function to delay your redirect.

For example, if you have a link as below, call the function on link click:

<a href="javascript:void" onclick="onBtnClickHandle()">Click Here</a>

Create a JavaScript function and add the delay using the setTimeout function:

  function onBtnClickHandle(){
    setTimeout(function(){ 
    window.location="https://www.google.com/"
 }, 3000);
}

You can set the timeout value as per your animation timing.

Demo:

  function onBtnClickHandle(){
        setTimeout(function(){ 
        window.location="https://www.google.com/"
     }, 3000);
    }
<a href="javascript:void" onclick="onBtnClickHandle()">Click Here</a>

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