Time for action – adding sound effects to the Play button
We will start with the code example available in the code bundle. We will have a folder structure similar to the one shown in the following screenshot:
Perform the following set of steps to add sound effects to the Play button:
The
index.html
file contains the basic structure of the HTML. Now let's add the following code to the body section of theindex.html
file:<div id="game"> <section id="menu-scene" class="scene"> <a href="#game"><span>Play</span></a> </section> </div> <audio id="buttonover"> <source src="media/button_over.aac" /> <source src="media/button_over.ogg" /> </audio> <audio id="buttonactive"> <source src="media/button_active.aac" /> <source src="media/button_active.ogg" /> </audio>
The HTML file runs successfully with a stylesheet. The file can be found in the code bundle...