How to stop the video after the closing video modal pop up?

First of all, sorry if you’ll see some mistakes in my grammar, it’s not my native language. Good, I created video modal pop up but it still playing the video after closing it. I found the topic with some solutions but still can’t understand how to do it. As I understood I need to paste a custom code in order to stop my video, it’s ok, but however how to tie this code with my “close link”? I I’m the newbie in this.

Thank you!

This topic is as a start point How to create video modal pop up?

Does anyone know? I think it’s not such hard question for a person who knows javascript. Take time to answer, please

Thank

Use Webflow lightbox?

Yes, but it doesn’t work properly for me. I have two modal popup in one row. It moving all the time so i don’t like it. I see the same thing on other webflow websites here. I almost have found the solution and real example where it works. I just tried to figure out now but it seems again I’m doing something wrong.

I called my video id as (my-video), then add this script

   <script type="text/javascript">

$(document).ready(function() {
  var vsrc = $('#my-video').attr('src');
  $('.modal-link-1').click(function(e) {
    e.preventDefault();
    $('#my-video').attr('src', vsrc);
    $('.modal-wrapper-video').fadeIn();
  });
  $('.close-modal-1').click(function(e) {
    e.preventDefault();
    $('#my-video').attr('src', '');
    $('.modal-wrapper-video').fadeOut();
  });
});

</script>

I don’t know if I have done all in the right way… Here I replaced id to my own (’#my-video’) and this (’.modal-wrapp>er-video’). It seems that it as on example http://leiden-islam-academie-v5.webflow.io/

then added this code javascript:stopthevideo(); to my “close link” in my modal popup. It still doesn’t work for now. Can anyone give me advice? It works well on the example website which I named. I think this theme will be helpful for a lot

Thank you!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.