I'm a complete newbie in the area of html/js. I need to create a very basic interface with 17 pictures. Each one, when clicked plays given sound.
After days of tinkering and looking for the right approach, I managed to create something that works and looks good, but with one small problem.
When one audio sample is triggered, clicking another picture should stop and reset the previous one. I found a lot of examples on this site, but my understanding of js syntax is so little I can't implement it properly.
I'd appreciate your help.
Here's what i have:
<script type="text/javascript" src="jquery-3.1.1.min.js"></script>
<script type="text/javascript">
$(document).ready( function() {
$('#track1').click(function() {
$('#1').append('<embed id="1" src="content/mp3/01.mp3" autostart="true" hidden="true"></embed>');
});
});
</script>
<img name="track1" src="content/img/01.jpg" width="180" height="180" border="0" id="track1" alt="" />
<div id="1"> </div>
I'd really appreciate your help.