diff --git a/rot.js b/rot.js index 7aa6d05..e5efe5a 100644 --- a/rot.js +++ b/rot.js @@ -76,7 +76,8 @@ } function volumeSet(number) { - localStorage.audiovolume = Math.round((audio.volume = number) * 100); + audio.volume = number; //Set + localStorage.audiovolume = Math.round(number * 100); //Save updateVolumeLabel(); } function volumeAdd(number) { @@ -248,7 +249,10 @@ audio.loop = true; audio.id = "user-music"; audio.style = "display:none;"; - localStorage.audiovolume = (audio.volume = localStorage.audiovolume ? localStorage.audiovolume / 100 : 0.5) * 100; + if (localStorage.audiovolume) + audio.volume = localStorage.audiovolume / 100; //Load volume + else + audio.volume = 0.2; //Default volume //Initialize audio controls and event listeners waitUntil("#music-controls").then((controls) => {