I am working for a company who wants to use 6 or 7 images on their landing page, ie each time a user opens/refreshes/loads the page they would get a different background image.
Is this possible and what is the most effective way of implementing?!
Custom code is how to pull this off and I would strongly advise against using background images since you canât have responsive images. Instead you would use <img> or the <picture> element plus CSS to get the affect. Remember that landing pages should be as performant as possible.
I think you could use a CMS collection. The collection could just have a name and an image (these would represent your background choices), then on your page you can make your âbackgroundâ element exist inside of one item in the collection.
In the settings youâd make the collection only ever show one of those elements. You can set a limit in the settings and also set it to choose a random element from the collection.
Based on the requirements provided by @blh1234 - your solution wonât meet them. It would only provide for a refresh every 12 hours regardless of refresh or multiple loads. Everyone sees the same thing. For many users yours is a simple and workable solution. Thanks for sharing!
OK i have taken a slightly different approach, ive created a slider and added various images to it, then have removed the navigational objects away so it just looks like an image. Now I need to work out how to set up the ârandomisedâ selection for the images on loading.
Using this page I have got the below code, but it doesnt seem to be working for meâŚ