Webflow sync, pageviews & more.
NEW

How can I stop a Webflow Vimeo video from playing with a button other than the play button, close the video window when the close window button is pressed, and autoplay the video when the window opens?

TL;DR
  • Embed a Vimeo video with autoplay=1&muted=1 in a hidden modal and use Webflow interactions to display it on button click.
  • Add a close button that hides the modal and either resets the iframe or uses Vimeo’s JavaScript API to pause the video instead of reloading it.

To autoplay a Vimeo video, stop it with a custom button, and close the video modal, follow these steps using Webflow’s embed and interactions features.

1. Use Vimeo Embed with Autoplay Enabled

  • Add an Embed element to your video modal.
  • Inside it, paste the Vimeo video URL with autoplay enabled:
    e.g., https://player.vimeo.com/video/123456789?autoplay=1&muted=1
  • The autoplay=1 will start the video automatically once the iframe/modal loads.
    If you want to ensure autoplay works on all browsers, add muted=1 to avoid user-interaction restrictions.

2. Set Up the Modal Open Interaction to Show Video

  • Wrap the embed video in a hidden modal div (e.g., set to display: none).
  • Create an Open Video button.
  • Add a click interaction to the button:
  • Show the modal and set display: flex or block.
  • (Optional) Reset the video iframe content if needed (to ensure fresh autoplay).

3. Use Close Button to Hide Modal and Stop the Video

  • Add a Close Video button to your modal.
  • Add a click interaction to the close button:
  • Hide the modal (e.g., set display: none).
  • Use element actions → Embed → Set iframe src to blank or empty, which effectively reloads/stops the video.

4. Use Custom JavaScript to Stop Vimeo Playback (Optional)

If you want to retain the video state or avoid iframe reloads, you can use Vimeo’s JavaScript API:

  • Give your iframe an ID (e.g., vimeo-player).

  • Add this custom code in the Page Settings → Before tag:

    ```javascript

    ```

  • This allows you to pause the video instead of reloading the iframe.

Summary

Use a Vimeo embed with autoplay parameters, control the video via Webflow interactions to show/hide the modal, and optionally add JavaScript to pause playback when the close button is pressed. This method ensures the video starts automatically when opened, and stops cleanly when closed.

Rate this answer

Other Webflow Questions