微信公众号内网页音频自动播放
#yy{ position: absolute; right:0%; top:25%; width:60px;height:66px; margin: -125px 0 0 -125px; z-index:99}
开关控制
<div id="yy"><img src="img/kai.png" onClick="vplay()" id="yyt" ></div>
音频
<div style="display:none"><audio preload="preload" controls id="car_audio" src="http://www.123.cn/123.mp3" loop></audio></div>
js
var yy=1;
document.addEventListener("WeixinJSBridgeReady", function () {
document.getElementById('car_audio').play();
}, false);
function vplay()
{
var myVideo=document.getElementById("car_audio");
if(yy==1){
myVideo.pause();
$("#yyt").attr('src',"img/guan.png");
}else{
myVideo.play();
$("#yyt").attr('src',"img/kai.png");
}
yy=Math.abs(yy-1);
}