<!DOCTYPE html>
<html lang="en">
<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>jeancsantana</title>
<style>
body {
font-family: sans-serif;
}
.download-container {
width: 50%;
margin: auto;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
border: 5px solid #FF5300;
padding-bottom: 5px;
}
.wait-text.common,
.download-btn {
display: block;
width: 100%;
text-align: center;
text-decoration: none;
margin-bottom: 5px;
}
.wait-text {
padding: 5px 0 20px 0;
}
.download-btn {
background-color: #FF5300;
color: #fff;
align-items: center;
padding: 10px 0;
}
</style>
</head>
<body>
<div class="download-container">
<a class="wait-text common" data-href="https://www.fiverr.com">El enlace de descarga aparecerá en <span class="wait-secs"></span> Segundos</a>
<span>Espere, el botón de descarga será visible en unos segundos.</span>
</div>
<script>
let DELAY = 25;
const waitTextSpan = document.querySelector('.wait-text');
const waitSecsSpan = document.querySelector('.wait-secs');
const downloadBtn = document.querySelector('.download-btn');
waitSecsSpan.innerText = DELAY;
const waitInterval = setInterval(() => {
waitSecsSpan.innerText = DELAY;
DELAY -= 1;
if(DELAY < 0) {
waitTextSpan.innerText = 'Descargar ahora';
waitTextSpan.href = waitTextSpan.getAttribute('data-href');
waitTextSpan.target = '_blank';
waitTextSpan.className = 'download-btn common';
clearInterval(waitInterval);
}
}, 1000);
</script>
</body>
</html>
Comentarios
Publicar un comentario