📜  javascript 播放许多背景音乐 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:38.683000             🧑  作者: Mango

代码示例1
jQuery(document).ready(function (){
var audioArray = document.getElementsByClassName('songs');
var i = 0;
audioArray[i].play();
for (i = 0; i < audioArray.length - 1; ++i) {
    audioArray[i].addEventListener('ended', function(e){
        var currentSong = e.target;
        var next = $(currentSong).nextAll('audio');
        if (next.length) $(next[0]).trigger('play');
    });
}
});