|
24 | 24 | if (!theme.isDark) { |
25 | 25 | moonButton.addEventListener("animationend", listener); |
26 | 26 | moonButton.classList.add("roll-out"); |
| 27 | + moonButton.classList.add("pointer-events-none"); |
| 28 | + sunButton.classList.add("pointer-events-none"); |
27 | 29 |
|
28 | 30 | function listener(event: AnimationEvent) { |
29 | 31 | if (event.type === "animationend") { |
30 | 32 | moonButton.classList.add("hidden"); |
31 | 33 | moonButton.classList.remove("roll-out"); |
32 | 34 | sunButton.classList.remove("hidden"); |
33 | 35 | sunButton.classList.add("roll-in"); |
| 36 | + moonButton.classList.remove("pointer-events-none"); |
| 37 | + sunButton.classList.remove("pointer-events-none"); |
34 | 38 | } |
35 | 39 |
|
36 | 40 | moonButton.removeEventListener("animationend", listener); |
37 | 41 | } |
38 | 42 | } else { |
39 | 43 | sunButton.addEventListener("animationend", listener); |
40 | 44 | sunButton.classList.add("roll-out"); |
| 45 | + sunButton.classList.add("pointer-events-none"); |
| 46 | + moonButton.classList.add("pointer-events-none"); |
41 | 47 |
|
42 | 48 | function listener(event: AnimationEvent) { |
43 | 49 | if (event.type === "animationend") { |
44 | 50 | sunButton.classList.add("hidden"); |
45 | 51 | sunButton.classList.remove("roll-out"); |
46 | 52 | moonButton.classList.remove("hidden"); |
47 | 53 | moonButton.classList.add("roll-in"); |
| 54 | + moonButton.classList.remove("pointer-events-none"); |
| 55 | + sunButton.classList.remove("pointer-events-none"); |
48 | 56 | } |
49 | 57 |
|
50 | 58 | sunButton.removeEventListener("animationend", listener); |
|
0 commit comments