-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
53 lines (50 loc) · 1.76 KB
/
test.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
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Pokémon Quiz</title>
<link rel="icon" href="favicon.ico" type="image/png" />
<link rel="stylesheet" href="test.css" />
</head>
<body>
<div class="container">
<div class="quiz-container">
<div><h2 id="question-text"></h2></div>
<div><img id="silhouette" src="" alt="Pokémon silhouette" /></div>
<div class="options">
<button class="option-btn" data-option="1">Option 1</button>
<button class="option-btn" data-option="2">Option 2</button>
<button class="option-btn" data-option="3">Option 3</button>
<button class="option-btn" data-option="4">Option 4</button>
</div>
</div>
</div>
<audio
id="hoverOption"
src="assets/audio/menu_sound.mp3"
preload="auto"
></audio>
<script>
document.addEventListener("DOMContentLoaded", () => {
const hoverOption = document.getElementById("hoverOption");
const containers = document.querySelectorAll(".option-btn");
console.log(hoverOption, containers);
containers.forEach((optionBtn) => {
console.log(optionBtn);
optionBtn.addEventListener("mouseenter", () => {
console.log("Mouse entered button script"); // Debugging
hoverOption.currentTime = 0;
hoverOption.play();
});
// optionBtn.addEventListener("mouseout", () => {
// hoverOption.pause();
// hoverOption.currentTime = 0;
// });
});
});
</script>
<audio id="cry-audio" preload="auto"></audio>
<script src="script.js"></script>
</body>
</html>