Last active
March 3, 2026 08:23
-
-
Save Crocoblock/8c9c4058e1ef1edff5111d1bf7841b54 to your computer and use it in GitHub Desktop.
JetPopup / Stop video after popup is closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.addEventListener('click', (e) => { | |
| const popup = document.getElementById('jet-popup-2580'); | |
| //replce jet-popup-2580 with jet-popup-(your popup id) | |
| if (!popup) return; | |
| if (!e.target.closest('#jet-popup-2580 .jet-popup__close-button, #jet-popup-2580 .jet-popup__overlay')) return; | |
| //replce jet-popup-2580 with jet-popup-(your popup id) | |
| const iframe = popup.querySelector('iframe[src*="youtube.com/embed"]'); | |
| //replce iframe[src*="youtube.com/embed"] to your selector if you don't have youtube video | |
| if (!iframe) return; | |
| iframe.dataset.savedSrc ||= iframe.src; | |
| iframe.src = 'about:blank'; | |
| setTimeout(() => (iframe.src = iframe.dataset.savedSrc), 50); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment