I want html audio code which will fit functions: on click audio on and on click audio again off. I searched whole day and found only this code:
html
<a href="#noscroll" id="mute">toggle sound</a>
javascript
var audio = document.getElementById('background_audio');
document.getElementById('mute').addEventListener('click', function (e)
{
e = e || window.event;
audio.muted = !audio.muted;
e.preventDefault();
}, false);
but this starts automaticly, I want audio start muted, then same function as it has.
Aucun commentaire:
Enregistrer un commentaire