make sound play on image clicks too
This commit is contained in:
parent
fbfef20c1a
commit
5f0bb3a02e
1 changed files with 37 additions and 26 deletions
|
@ -10,19 +10,30 @@ function PlaySound(soundobj) {
|
||||||
thissound.currentTime = 0;
|
thissound.currentTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const audio = new Audio("/assets/sounds/ui/zapsplat_multimedia_button_click_004_68776.mp3");
|
const audio = new Audio(
|
||||||
|
"/assets/sounds/ui/zapsplat_multimedia_button_click_004_68776.mp3"
|
||||||
|
);
|
||||||
const buttons = document.querySelectorAll("button");
|
const buttons = document.querySelectorAll("button");
|
||||||
const links = document.querySelectorAll("a");
|
const links = document.querySelectorAll("a");
|
||||||
|
const image = document.querySelectorAll("img");
|
||||||
|
|
||||||
// biome-ignore lint/complexity/noForEach: <explanation>
|
// biome-ignore lint/complexity/noForEach: <explanation>
|
||||||
links.forEach(a => {
|
links.forEach((a) => {
|
||||||
a.addEventListener("click", () => {
|
a.addEventListener("click", () => {
|
||||||
audio.play();
|
audio.play();
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
// biome-ignore lint/complexity/noForEach: <explanation>
|
// biome-ignore lint/complexity/noForEach: <explanation>
|
||||||
buttons.forEach(button => {
|
buttons.forEach((button) => {
|
||||||
button.addEventListener("click", () => {
|
button.addEventListener("click", () => {
|
||||||
audio.play();
|
audio.play();
|
||||||
});})
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// biome-ignore lint/complexity/noForEach: <explanation>
|
||||||
|
image.forEach((button) => {
|
||||||
|
button.addEventListener("click", () => {
|
||||||
|
audio.play();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue