-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
42 lines (38 loc) · 1.04 KB
/
example.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
40
41
42
<!DOCTYPE html>
<html>
<head>
<title>Add/Remove Class Example</title>
<style>
.animated-button {
transition: background-color 0.5s ease-in-out;
}
.animated-button.highlight {
background-color: yellow;
}
</style>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<button class="animated-button">Button 1</button>
<button class="animated-button">Button 2</button>
<button class="animated-button">Button 3</button>
<button class="animated-button">Button 4</button>
<script>
$(document).ready(function() {
var buttons = $('.animated-button');
var index = 0;
function animateButton() {
buttons.eq(index).addClass('highlight');
setTimeout(function() {
buttons.eq(index).removeClass('highlight');
index++;
if (index < buttons.length) {
setTimeout(animateButton, 500);
}
}, 500);
}
animateButton();
});
</script>
</body>
</html>