浏览代码

添加进入点击窗口播放

lanxin 2 天之前
父节点
当前提交
5981c46f85
共有 1 个文件被更改,包括 11 次插入0 次删除
  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')) {