-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Placed the music button with a check box option in the general settin…
…gs (#367) * placed the music button with a check box option * fix * fixed * added bottom border
- Loading branch information
1 parent
941bcd0
commit e6ffc79
Showing
4 changed files
with
19 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
const bgMusic = document.getElementById('bg-music'); | ||
let musicOn = true; | ||
let music = false; | ||
|
||
function toggleMusic() { | ||
if (musicOn) { | ||
if (music) { | ||
bgMusic.pause(); | ||
document.querySelector('.music-text').textContent = 'Music Off'; // Change button text | ||
document.querySelector('.toggle-button i').className = 'fa-solid fa-volume-xmark'; | ||
} else { | ||
bgMusic.play(); | ||
document.querySelector('.music-text').textContent = 'Music On'; // Change button text | ||
document.querySelector('.toggle-button i').className = 'fa-solid fa-volume-high'; | ||
} | ||
musicOn = !musicOn; | ||
} | ||
music = !music; | ||
document.getElementById("music-toggle").checked = music; | ||
} |