Browse Source

添加进入点击窗口播放

lanxin 2 days ago
parent
commit
5981c46f85
1 changed files with 11 additions and 0 deletions
  1. 11 0
      index.html

+ 11 - 0
index.html

@@ -826,6 +826,17 @@ headers: {
       const musicPlayer = document.getElementById('backgroundMusic');
       const baseBg = document.getElementById('baseBg');
       const baseBtn = document.getElementById('baseBtn');
+      const guiParent = document.querySelector('#gui-parent');
+
+      const isplay = false
+      guiParent.addEventListener('click',()=>{
+        if(!isplay){
+          musicPlayer.play();
+          baseBg.style.display = 'none';
+          volumeImg.src = 'images/Volume btn_off.png';
+          isplay = true
+        }
+      })
 
       // 检查URL中是否包含‘&firstView’
       if (window.location.search.includes('firstView')) {