diff --git a/index.html b/index.html index 028145b..1d2eb79 100644 --- a/index.html +++ b/index.html @@ -7,6 +7,12 @@ 鱼了个鱼 + + +
+
+ +
diff --git a/src/assets/musics/1.mp3 b/src/assets/musics/1.mp3 new file mode 100644 index 0000000..5d9daa2 Binary files /dev/null and b/src/assets/musics/1.mp3 differ diff --git a/src/assets/musics/2.mp3 b/src/assets/musics/2.mp3 new file mode 100644 index 0000000..87a1640 Binary files /dev/null and b/src/assets/musics/2.mp3 differ diff --git a/src/assets/musics/auto-music.js b/src/assets/musics/auto-music.js new file mode 100644 index 0000000..984babf --- /dev/null +++ b/src/assets/musics/auto-music.js @@ -0,0 +1,24 @@ +//--创建页面监听,等待微信端页面加载完毕 触发音频播放 +document.addEventListener("DOMContentLoaded", function () { + function audioAutoPlay() { + var audio = document.getElementById("audio"); + audio.play(); + document.addEventListener( + "WeixinJSBridgeReady", + function () { + audio.play(); + }, + false + ); + } + audioAutoPlay(); +}); + +//--创建触摸监听,当浏览器打开页面时,触摸屏幕触发事件,进行音频播放 +document.addEventListener("touchstart", function () { + function audioAutoPlay() { + var audio = document.getElementById("audio"); + audio.play(); + } + audioAutoPlay(); +});