添加音乐
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script> <style type="text/css"> /*音乐*/ .music{ position:fixed; top:5px; right:5px; z-index:9999; width:22px; heigth:22px; background:url(imgs/music_off.png) no-repeat; background-size:100% 100% } .music .on{ background:url(imgs/music_on.png) no-repeat; background-size:100% 100%; -webkit-animation:rotating 1.2s linear infinite; } @-webkit-keyframes rotating{ from{-webkit-transform:rotate(0deg);} to{-webkit-transform:rotate(360deg);} } </style> <div class="music on"> <audio id="audio" autopaly="autoplay" src="./img/tears.mp3" loop="loop"></audio> </div> <script> document.getElementById("audio").play(); document.addEventListener("WeixinJSBridegeReady", fucntion(){ WeixinJSBridge.invoke('getNetworkType', {}, function(e){ document.getElementById('audio').play(); }); }, false); </script>效果图