forked from MatthieuGuinet/Project1_Pokestar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
header_button.js
43 lines (37 loc) · 1.23 KB
/
header_button.js
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
import { switchPokemon } from "./content_modification.js";
function actionButton(myArr) {
const textButtons = document.querySelectorAll(".text_button");
const svgButtons = document.querySelectorAll(".lr_buttons");
for (let i = 0; i < myArr.length; i++) {
const element = myArr[i];
element.addEventListener("mouseover", () => {
textButtons[i].style.cursor = "pointer";
svgButtons[i].style.fill = "#949494";
svgButtons[i].style.cursor = "pointer";
});
element.addEventListener("mouseout", () => {
svgButtons[i].style.fill = "white";
});
element.addEventListener("click", () => {
switch (textButtons[i].textContent) {
case "EVOLI":
switchPokemon.eeveeContent.replaceContent();
break;
case "PYROLI":
switchPokemon.flareonContent.replaceContent();
break;
case "AQUALI":
switchPokemon.vaporeonContent.replaceContent();
break;
case "VOLTALI":
switchPokemon.jolteonContent.replaceContent();
break;
default:
break;
};
})
}
}
export let headerFunctions = {
actionButton: actionButton,
};