New Video is online!
Twitter Icon

How to Play Videos on Hover in Webflow

Looking to create engaging hover effects on your Webflow website? Learn how to add video hover effects with these simple steps. (Video-Tutorial included!)
March 3, 2023

You'll be learning about:
👉  Webflow Custom Code Embeds
👉  jquery in Webflow
👉  Shortcuts in Webflow
👉  Basic DOM manipulation with JavaScript

How to Make Your Video Only Play on Hover

Have you ever come across a website where a video starts playing automatically, and you have to scramble to pause it? Or maybe you want to add a little more interactivity to your website and have a video only play when someone hovers over it? In this tutorial, we’ll show you how to do just that with a little bit of code.


Hi, I’m Marvin Aziz, a freelance developer, and in this tutorial, I’ll be showing you how to add a smooth hover effect to your video. We’ll be replacing an image in the middle of a design I previously built with a video that only plays on hover.


Before we get started, you’ll need some basic HTML, CSS, and JavaScript knowledge. Don’t worry if you’re not an expert, we’ll guide you through the steps.

Steps to Follow

Let's dive in!

  1. Remove the image where you want the video to appear.
  2. Find the embed element and replace it with the video element.
  3. Add a div wrapper called “hover video wrapper” and place the video element inside it.
  4. Loop the video and preload it. Also, make sure it’s initially muted.
  5. Host the video on a website. (Note: Hosting videos on Webflow can be challenging.)
  6. Open your page settings and scroll down to the head and body tag.
  7. Copy and paste the JavaScript code to the body tag.
  8. Modify the code if you want to use multiple videos.
  9. Loop over all the videos on the page and add event listeners.
  10. Check if the mouse is on top of the video.
  11. If the mouse is on top of the video, play the video.
  12. If the mouse moves out of the video, pause the video and keep track of the time where it last played.
  13. Publish your website and check the final result.
  14. Celebrate!

Code Explained

Let's break down the JavaScript code step-by-step.

First, the code will get all the video sequences on the page. Then it will loop over all the videos and add event listeners. The event listener will check if the mouse is on top of the video. If it is, the video will play. If the mouse moves out of the video, the video will pause and resume from where it left off the next time it’s played. This results in a smooth and seamless experience for your website visitors.


And that’s it! You’ve successfully added a hover effect to your video using a few lines of code. Now you can engage your website visitors with interactivity and keep them engaged with your content. Thank you for reading, and I hope this tutorial was helpful.


  1. Can I use this code on multiple videos on my website?
    Yes, you can. Just loop over all the videos you want to use with this effect.
  1. Can I modify the code to fit my specific needs?
    Absolutely! You can customize the code to match your requirements.
  2. What if I want the video to start playing on click instead of hover?
    You can modify the code to add an event listener for a click instead of a hover.
  3. Is this code compatible with all browsers?
    This code works on most modern browsers, including Chrome and Firefox.
  4. What if my video is not playing smoothly?
    There could be many reasons why your video is not playing smoothly, such as slow internet speed or large file size. Try compressing your video and hosting it on a faster server.

🧑🏾‍💻 Link to the Code-Snippet mentioned:

I really hope this video helps you make your Webflow Website even more unique. If you want to learn more Hover-Effects in Webflow check out my Playlist
⏩ Playlist for Webflow Basics:


Let all the good stuff come to you

Sign up and receive my top 15+ clonables for Webflow for free! You’ll also receive High quality content educating you about how to create stunning Webflow projects & my favorite tools to do so!