-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
35 lines (31 loc) · 1.16 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<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>Time Wastage</title>
<link rel="stylesheet" type="text/css" href="./style.css">
</head>
<body>
<div class="container">
<div class="btn" data-link="/v2.html"><a href="#">Read-Time:: 5sec.</a></div>
<div class="btn" data-link="v1.html"><a href="#">Read-Time:: 3min.</a></div>
</div>
<script>
document.querySelectorAll('.btn').forEach(btn => {
btn.addEventListener('click', function (event) {
event.preventDefault();
// Get the link from the data attribute
const link = this.getAttribute('data-link');
// Get the anchor element to check the animation duration
const anchor = this.querySelector('a');
// Start the animation if the button is hovered
this.classList.add('hovered');
// Set a timeout for the animation duration
setTimeout(() => {
// Redirect to the link after the animation completes
window.location.href = link;
}, 500); // Match this duration to your CSS animation duration
});
});
</script>
</body>