Adding a Soundtrack Behind an Image

1. Go to the course component you wish to add this feature.

2. Click on HTML, and then on Raw HTML.

3. Copy and paste the following HTML code and change the elements highlighted in blue:

<style type=”text/css”>

#cat{

cursor:pointer;

}

</style>

<a onclick=”myAudioFunction(‘a’);”> <center><img id=”cat” src=”/static/mr_scruff.png” width=”550″></center></a>

<script>

var Audio = new Audio(‘https://s3-eu-west-1.amazonaws.com/videofrance/Kalimba.mp3’);

var bAudio = new Audio(‘b.mp3’);

window.myAudioFunction = function(letter){

console.log(letter)
if(letter == ‘a’) {
aAudio.play();

}

}

</script>

Learner platform display:

Login to leave your feedback!

Leave a Reply

You must be logged in to post a comment.