Search
Other Modals questions
Forum

Stopping the audio when the modal closes.

Dom Cassone's Avatar Dom Cassone
I have a modal that looks like this:
{modal content="part1" title="Play Audio"}Listen to Part 1{/modal}
{modalcontent part1}
<img src="images/tmm/tmm_mission_businessman-pushing-wheelbarrow-uphill-in-debt-loan-concept_copy.jpg" width="250" height="150">
<audio controls>
<source src="images/audio/TMM-The-Mission.mp3" type="audio/mpeg">
</audio>{/modalcontent}

It works great, except that the audio keeps playing when the modal window is closed.
See it at mytmm-dev.zacaw.com/the-method and choose any of the 6 audios.

How can I get the audio to stop when the window closes.

Thanks,
Dom
Peter van Westen's Avatar Peter van Westen ADMIN
The solution would be to not use the inline content.
Place the image and mp3 in a different article. Then open that article via Modals.

Or use the Javascript events to add a custom piece of javascript that would stop the mp3:
docs3.regularlabs.com/modals/going-further/javascript-events
Please post a rating at the Joomla! Extensions Directory
Dom Cassone's Avatar Dom Cassone
THANKS, that worked!
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription