IMAGEN FIJA EN WEBSITE CON FUNCION ONCLICKplay and stop
Código para copiar y pegar
<img src="img/pedro_pe.png" alt="Capibara" title="Capibara Song" style="height: 45px; position: fixed; right: 2%; top: 44%; cursor: pointer; border-radius: 50%;" onclick="playSound('sound2')" >
<audio id="sound2" src="media/pedro-pe.mp3"></audio>
function playSound(sound2) {
var song1 = document.getElementById(sound2);
song1.volume = .25; // setting the volume to 25% because the sound is loud
if (song1.paused) { // if song1 is paused
song1.play();
} else {
song1.pause();
}
}
No hay comentarios:
Publicar un comentario