I realise this has been asked before and for that, I apologise but as it stands I can’t get a pop up modal to stop playing a video when the close button is pressed.
Any help would obviously be grand.
Thank you!
HTML:
<div class="converseVideo">
<div class=textAnchor>
<h3 class=stickyConverseText>I was lost for language too</h3>
</div>
<video autoplay muted loop class="myVideo converseVideoContainer">
<source src="Media/converse.mp4" type="video/mp4">
</video>
<button onclick="toggleConversePopUp()" class="playButton conversePlayButton">
<img src="Media/playIcon.jpg" title="Play Icon">
</button>
<h2 class=videoTagsLeft>Converse</h2>
</div>
<div class="videoPopUp" id="popup-1">
<video class="conversePopUp" id="myVideo" controls>
<source src="Media/converse.mp4" type="video/mp4">
</video>
<button class="closeButton" onclick="toggleConversePopUp()" >×</button>
</div>
and this is the JS:
let modalOpen = false; // Default to closed
function openModal() {
setModal(true);
}
function closeModal() {
setModal(false);
}
function toggleModal() {
setModal(!modalOpen);
}
function setModal(value) {
modalOpen = value;
document.getElementById("popup-1").classList.toggle("active", value);
}
function pauseMedia() {
document.querySelector('video').pause()
}
function playMedia() {}
function toggleConversePopUp(){
document.getElementById("popup-1").classList.toggle("active");
}