Code

Pause/Reset Vimeo Embed on Modal Close

Automatically pause or reset a Vimeo video on modal close in Webflow via this helpful Javascript code. This prevents Vimeo videos to continue to play if they happen to be in a modal on your Webflow site.

Pause/Reset Vimeo Embed on Modal Close preview

Automatically pause or reset a Vimeo video on modal close in Webflow via this helpful Javascript code. This prevents Vimeo videos to continue to play if they happen to be in a modal on your Webflow site.

How to add it

  1. Add the Javascript code to your closing body tags of your custom code section on the page
  2. Update the class to your relevant class

The code

Javascript
                      <!-- Add to closing body -->
<script>

//stop all vimeo videos when close
$(function(){
    $('.close-video').click(function(){
        $("iframe").each(function() {
            var src= $(this).attr('src');
            $(this).attr('src',src);
        });
    });
});
</script>

                    

Browse similar code snippets

Categories

Language

More from Corey Moen

Profile →

Related Webflow questions

All answers →

Similar code snippets

All code snippets →