# Stop Video in a modal after modal close

**URL:** <https://forums.realmacsoftware.com/t/stop-video-in-a-modal-after-modal-close/53639>\
**Category:** Elements\
**Created:** [January 14, 2026, 7:19pm UTC](https://forums.realmacsoftware.com/t/stop-video-in-a-modal-after-modal-close/53639 "2026-01-14T19:19:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![IdahoSAM](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/idahosam/32/15242_2.png) [@IdahoSAM](https://forums.realmacsoftware.com/u/IdahoSAM)\
**Post date:** [January 14, 2026, 7:19pm UTC](https://forums.realmacsoftware.com/t/stop-video-in-a-modal-after-modal-close/53639/1 "2026-01-14T19:19:03Z")

</div>

I have a video in a modal. How do I get the video to stop playing after the modal is closed? I can hear the audio still playing in the background.

Tried the bot, but I keep getting different code to type into the javascript section, and none of it works.

---

<div class="post-metadata">

**Author:** ![ben](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/ben/32/28488_2.png) [@ben](https://forums.realmacsoftware.com/u/ben)\
**Post date:** [January 15, 2026, 7:24am UTC](https://forums.realmacsoftware.com/t/stop-video-in-a-modal-after-modal-close/53639/2 "2026-01-15T07:24:59Z")

</div>

That’s not currently possible with the current versions of the Modal, however, I’ll take a look at this and see if we can get a fix for it in the next release 🙂

---

<div class="post-metadata">

**Author:** ![IdahoSAM](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/idahosam/32/15242_2.png) [@IdahoSAM](https://forums.realmacsoftware.com/u/IdahoSAM)\
**Post date:** [January 15, 2026, 8:13am UTC](https://forums.realmacsoftware.com/t/stop-video-in-a-modal-after-modal-close/53639/3 "2026-01-15T08:13:52Z")

</div>

Thank you!

---

<div class="post-metadata">

**Author:** ![IdahoSAM](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/idahosam/32/15242_2.png) [@IdahoSAM](https://forums.realmacsoftware.com/u/IdahoSAM)\
**Post date:** [February 8, 2026, 9:25am UTC](https://forums.realmacsoftware.com/t/stop-video-in-a-modal-after-modal-close/53639/4 "2026-02-08T09:25:54Z")

</div>

With the 2.0 beta, the sound from the video component does turn off when I close the modal, but then a few seconds later, the audio begins over.  
Looping option is OFF. Almost there with a “cure” to stopping sound when modal is closed. The Create a Family Video tile opens a modal, the video plays. When I close the modal, the audio stops and a few seconds later, it starts again.  
The Discover Your Family’s Heritage tile opens up a tile, the video plays, and when I close the modal, the audio stops.  
Both modals are set up exactly the same. No known reason why this is happening.

[https://elements.famhx.net/discovery/activities/](https://elements.famhx.net/discovery/activities/)

@ben Just FYI.

---

<div class="post-metadata">

**Author:** ![IdahoSAM](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/idahosam/32/15242_2.png) [@IdahoSAM](https://forums.realmacsoftware.com/u/IdahoSAM)\
**Post date:** [February 11, 2026, 1:09pm UTC](https://forums.realmacsoftware.com/t/stop-video-in-a-modal-after-modal-close/53639/5 "2026-02-11T13:09:25Z")

</div>

Bot had suggested this code to be place in the global template between the Body area to stop video play process once I close the modal. The “.modal-close-button” class is added to the modal close button in the Advanced section of the button. Seems to work, especially with with YouTube videos. If I have a .mp4 video file on the server, and link to that, then the video stops automatically without the code below.
