Streaming live at 10am (PST)

Closing and Stopping a video with an element - Can't get it to work!

The facts: I have a fullscreen video that is initially hidden, then triggered to be shown with an interaction. I needed to make a button that closed and STOPPED the video. I dug around and found a script that would make this happen. I needed to add another instance the close video button and with it I added more custom code. Now it doesnt work.

The triggers that show the videos and the videos themselves with the close button are located on the “M&C” page. Let me know if they are hard to find.

For the life of me I cannot figure it out. Below is the custom code (with one extra piece for a slideshow thingy).

Any help would be amazing!! THX

<script>
$(document).ready(function() {
$('#thc_slider_main div:nth-child(2)').trigger('tap');
});


$(document).ready(function() {
  $('#closeglenn').click(function() {
    StopEmbedVideo();
  });
});

function StopEmbedVideo() {
  var $frame = $('iframe#glenn');

 // saves the current iframe source
 var vidsrc = $frame.attr('src');

// sets the source to nothing, stopping the video
$frame.attr('src',''); 

   // sets it back to the correct link so that it reloads immediately on the next window open
   $frame.attr('src', vidsrc);

}

$(document).ready(function() {
  $('#closeelle').click(function() {
    StopEmbedVideo();
  });
});

function StopEmbedVideo() {
  var $frame = $('iframe#elle');

 // saves the current iframe source
 var vidsrc = $frame.attr('src');

// sets the source to nothing, stopping the video
$frame.attr('src',''); 

   // sets it back to the correct link so that it reloads immediately on the next window open
   $frame.attr('src', vidsrc);

}

</script>

Here is my public share link: https://preview.webflow.com/preview/mother-clone?utm_source=mother-clone&preview=f0dee78bfc5df8844b2592648d6f9a61
(how to access public share link)

Add live url. And anyway console.log() to check if the “close” function run.

Also what code you added.

Sorry:

The live link https://mother-clone.webflow.io/mc

The code I added was another instance of the script that closes the other video.

Not 100% sure what you mean by “console.log()” is. I’m not great at this stuff hahaha