Streaming live at 10am (PST)

Custom code for random image

Piter was kind enough to share this random load image with the community and I’m interested in using a version of it on my test site.
I checked all the sections and the code attributes of each is empty. Where else should I look for the code that controls the images?

Thanks guys


Hi,

there is custom code sitting in the Home Page Settings:

<script>

function getRandomImage() {
var images = ['https://uploads-ssl.webflow.com/5c2c6dbdbda735089ed987bd/5c2c6ef34fdbba48b6c60fee_12010751_1065862006781016_379064316535681415_o.jpg', 'https://uploads-ssl.webflow.com/5c2c6dbdbda735089ed987bd/5c2c6ef2bda7350e0dd9891d_10623927_1060183480682202_7004552997097781759_o.jpg', 'https://uploads-ssl.webflow.com/5c2c6dbdbda735089ed987bd/5c2c6ef29a15752b768c5a6e_10869774_1057325170968033_4419854124680164396_o.jpg'];
var image = images[Math.floor(Math.random()*images.length)];
 
return image;
}
 
function displayRandomImage() {
var htmlImage = document.getElementById("randomImage");
htmlImage.src = getRandomImage();
}
displayRandomImage();

</script>
1 Like

Thanks Chris.
I’m still learning my way around the interface. Where on the home page can I access the settings?

Here is how you can reach the page settings:

grafik

Scroll all the way down to “Custom Code”:

1 Like

Thanks Chris. The cog icon didn’t appear until I moused over it so I was overlooking it.