0
Randomised video selector
Does anyone know how I can make it possible for a video to be picked at random (out of a selection of 3) when someone enters the website?
2 Answers
+ 5
You can use JavaScript random function to generate random numbers which you can use as index to choose from an array of video URLs.
// an array of video URLs
var videoURLs = ["video1.mp4","video2.mp4","video3.mp4"];
// pick random video URL to use
var URL = videoURLs[Math.floor(Math.random() * 3)];
Hth, cmiiw
+ 2
use JavaScript function