Streaming live at 10am (PST)

Stop Vimeo video with another button


Share link

I would love to stop a vimeo video from playing with another button than the play button. :slight_smile:

If you press the play button a window opens up with a embed vimeo video inside.

  1. I would like the video to stop playing when you press the close window button under the video
  2. If possible I would like the video to autoplay when the window open.

Is this something anyone can help me with? :slight_smile:


Hi @krubens, thanks for the good question.

At the moment closing a modal window when playing an iframe embed will not stop the video without a little help from some custom code.

You can try this, first give your iframe an ID like “embedvideo”:

Set the ID of the link that closes the video embed to “closevid”:

Next, add a little custom code to the Before Body of the page:

    $(document).ready(function() {
      $('#closevid').click(function() {

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

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

    // sets the source to nothing, stopping the video

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


Next republish the site, play the video then click the close link to unload the video.

I hope this helps.


Thank you Dave! Works like a sharm!

BUT :smiley: Now the video is gone, can you add to the code when you press the Play button in the Hero sections its back to how it was? So if they want to see it again they can :slight_smile:


Hi, I have updated the script, copy and replace the old code, see if that helps.



Dave, I hope its ok that I say this, but I love you! :smiley: <3
Works great! Thank you so much!


Will this work for Youtube videos as well? Tried and am getting this error in the console. The videos still work on the hosted domain but my test on the site gave me this.
[Error] Failed to load resource: The network connection was lost. (media.html, line 0)

Any ideas?

Share Link


Hi @ Cyberdave,

first off, thank you for the script! It works great and would like to use this code in combination with a collection list.

I have a collection list with several buttons to show multiple Vimeo Videos in a Custom Modal Window and Custom Embed Code for the Iframe, changing the code and ids of the individual videos with the collection list. I came across a few problems using more than one video :slight_smile:

One Video:
-Using a single video everything works great with the combination of the collection

Multiple videos:
-The modal window shows with a different button the same video (i guess it is something about the unload video option)

  • The Stop video button does not work

i am sure there is a simple solution but i can’t figure it out or find anything like this on the internet.


Thanks for the script @cyberdave !

I was trying this out on my company’s site with a custom modal that pops up the the native webflow video element, but was’st able to get it to work untill I edited the script from refering to the iframes id as #embedvid and changed it to the class .embedly-embed

I am by no means certified to say if that is correct or isnt going to break something else on my site, but i did get ot to work that way. Wondering if that is bad form or can cause other problems. Site wide?

Thanks again!

link: (in the 360 video section)


I ran into the same problem, any ideas how to do it if there are multiple videos from a collection?



Hey, did you figure out how to stop multiple videos when clicking the X button?
I’m struggling with this issue because I have to script several videos instead of one