Streaming live at 10am (PST)

Background video pause button


#1

Hi there,

I'd like to pause a background video with a button. Is that possible?
Can someone post a code to do that?

Thanks


#2

Give your button an ID (not class!) of pause-videos.

Add this in your Site Dashboard > Custom Code > Footer Code

<script>
var Webflow = Webflow || [];
Webflow.push(function() {
  $('#pause-videos').click(function() {
    $('video').get(0).pause();
    return false;
  });
});
</script>

Save and publish (cannot view in designer)


Also, feel free to contact me for further code help and/or customization of third-party plugins


#3

Thanks a lot @samliew. It works flawlessly!


#4

Hi @samliew is it possible to automatically stop the background video after one play?


#5