Skip to content

Commit

Permalink
feat: randomize delay
Browse files Browse the repository at this point in the history
  • Loading branch information
asdofindia committed Mar 29, 2024
1 parent 83ba389 commit 42520ad
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ <h1 class="title">
</div>
`);

const getRandomBetween = (a, b) => {
const diff = b - a;
return a + Math.random() * diff;
}

search.addEventListener('submit', (e) => {
e.preventDefault();
const t = document.getElementById("table");
Expand All @@ -194,7 +199,7 @@ <h1 class="title">
setTimeout(() => {
document.getElementById('search-only').style.display = 'none';
t.style.display = 'block';
}, 1000)
}, getRandomBetween(500, 2500))
})
</script>
</body>
Expand Down

0 comments on commit 42520ad

Please sign in to comment.