-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
39 lines (38 loc) · 997 Bytes
/
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
36
37
38
39
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Static Template</title>
<style>
@keyframes new-item-animation {
from {
box-shadow: 0 0 16px 10px green;
}
to {
box-shadow: 0 0 0 0 transparent;
}
}
.card {
height: 300px;
border-radius: 10px;
background-color: red;
animation: new-item-animation 1s ease-in;
}
</style>
</head>
<body>
<h1>Restart CSS Animation with pure HTML</h1>
<button onclick="renew()">Renew</button>
<div class="card"></div>
<script>
function renew() {
const oldCard = document.querySelector(".card");
const newCard = oldCard.cloneNode();
oldCard.remove();
document.body.appendChild(newCard);
}
</script>
</body>
</html>