JavaScriptNo Comments

default thumbnail

By using the javascript, Pause the all audio but not the current audio we have played. Just place the below script in footer.

Javascript


document.addEventListener('play', function(e){ var audios = document.getElementsByTagName('audio'); 
for(var i = 0, len = audios.length; i < len;i++){ if(audios[i] != e.target)
{ audios[i].pause(); }
 }
 }, true);

Be the first to post a comment.

Add a comment