I want to implement background music on a site i'm creating. Theres also a music video thats pops out when a user hits the play button. How can I pause the background music once the play button is clicked on?
Play button html - The play button triggers a fancybox video popup. This is when I'd like to pause the background sound below.
<div class="play-btn ">
<a class="fancybox-media" href="https://vimeo.com/1741943434" >
<img src="../img/play-btn.svg" alt="">
</a>
</div>
Audio file
<audio autoplay>
<source src="sound.ogg" type="audio/ogg">
<source src="sound.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
How should I approach this?