Streaming live at 10am (PST)

How To: Showcase different videos on each new homepage load?

Hey everyone,

I’m new to Webflow and am about to embark on my first build. The design is squared away, but I have a question about custom videos loading on the homepage and how to go about it.

Is it possible to have, say, 3 versions of a video that are selected randomly each time the homepage loads? We’re planning on showcasing different animated versions of our logo as the homepage key art, and would love to have a different version play on each new load…

Is this possible, and how would you go about it?

Thanks for the help!

Cheers

Hi

you can use this js code.

put your video into 3 separate divs and randomly show only one at a time.

Hi Color2life,

I’ve been looking at doing the same thing - so thanks for the code.
Just a question on how to implement this - where would the JS go? - do you have a webflow example? - or could you do one?

Thanks
Pete

The javascript would go into your page settings. Scroll to the bottom of the page settings, and insert the code into the Before </ body> tag.

Make sure to change the “.vid” in the javascript to match the class you’ve already set. So if you’ve named your video element “video”, “video-player”, etc., then change the javascript from “.vid” to “.video”, “.video-player”, or whatever you’ve named it. Look at example below.

Keep in mind the code won’t work in preview mode. You need to publish the site.

Cool, thank you! I will try it and see how I go. Cheers everyone.