]> git.bochard.net Git - mysite.git/commitdiff
respect the user whether to turn on the bg music. im getting tired of this.
authorbochard <mail@tenkyuu.dev>
Tue, 25 Mar 2025 13:24:12 +0000 (21:24 +0800)
committerbochard <mail@tenkyuu.dev>
Tue, 25 Mar 2025 13:24:12 +0000 (21:24 +0800)
index.html

index 0599e55b9c5d409ea463e0c3d0d86c79a4d863f9..94f4abe68d074ce9e33912de90ce1a530675ed16 100644 (file)
@@ -87,19 +87,7 @@ footer {
 </style>\r
 </head>\r
 <body>\r
-  <audio id="bg-music" src="./audios/background/rejectedworld.mp3" controls autoplay loop muted></audio>\r
-  <script>\r
-    const bgMusic = document.getElementById('bg-music');\r
-\r
-    window.addEventListener('scroll', function() {\r
-      bgMusic.muted = false;\r
-      bgMusic.play().catch(function(error) {\r
-        console.error("Autoplay was prevented!", error);\r
-      });\r
-\r
-      window.removeEventListener('scroll', arguments.callee);\r
-    });\r
-  </script>\r
+  <audio id="bg-music" src="./audios/background/rejectedworld.mp3" controls loop></audio>\r
   <header>\r
     <img src="./images/gifs/doraemon.gif" alt="doraemon hello gif" width="100">\r
     <img src="./images/gifs/welcomemovetree.gif" alt="tree with welcome text gif" width="300">\r