]> git.cworth.org Git - zombocom-ai/commitdiff
Fix the mute toggle
authorCarl Worth <cworth@cworth.org>
Wed, 7 Dec 2022 01:00:07 +0000 (17:00 -0800)
committerCarl Worth <cworth@cworth.org>
Wed, 7 Dec 2022 01:00:07 +0000 (17:00 -0800)
Which we broke by dropping its id in the previous commit.

index.html

index 0bc723c8e6eec211de02b38f2604d1d1ba4d3c40..8214163c8d399c1d4a42c3ed91790feac528eeb9 100644 (file)
   </div>
 
   <audio loop="" src="/zombo_words.mp3" type="audio/mpeg"></audio>
-  <button class="fade volume">
+  <button id="mute" class="fade volume">
     <div>🔊</div>
     <script>
-const button = document.querySelector("#button");
-const icon = document.querySelector("#button > div");
+const mute = document.querySelector("#mute");
+const icon = document.querySelector("#mute > div");
 const audio = document.querySelector("audio");
 
-button.addEventListener("click", () => {
+mute.addEventListener("click", () => {
   if (audio.paused) {
       audio.volume = 0.2;
       audio.play();
@@ -69,7 +69,7 @@ button.addEventListener("click", () => {
       audio.pause();
       icon.innerHTML = "🔊";
   }
-  button.classList.add("fade");
+  mute.classList.add("fade");
 });
     </script>