.pause() and set .currentTime = 0 for native <video> elements when closing the modal. src to stop playback since .pause() won't work.To stop a video from continuing to play after closing a modal in Webflow, the issue is likely due to the way browser video APIs or iframe embeds behave. If you're using a YouTube or Vimeo embed, .pause() won't work because it's an iframe, not a native HTML5 video.
<video>), .pause() and .currentTime = 0 should work..pause().
Use the following approach in your custom code:
<video> element correctly.
```javascript
var vid = document.getElementById("modal-video");
vid.pause();
vid.currentTime = 0;
```
YouTube iframes require resetting their src to stop playback:
src like this:
```javascript
var iframe = document.getElementById("youtube-iframe");
var currentSrc = iframe.src;
iframe.src = currentSrc;
```
If you need more control (like .stopVideo()), integrate the YouTube Iframe Player API, but this adds additional setup and scripting.
To stop video playback after closing a modal in Webflow:
.pause() and .currentTime = 0 for native video elements after ensuring correct selection.src attribute to stop playback..pause() does not work on iframes, so check your video type.