kaydotjpg Posted June 12 Share Posted June 12 https://parakeet-chrysalis-lnzs.squarespace.com/ password: madcap Hi! My client would like the large, main gallery on her home page (which is currently set to automatically transition between slides), to only show 1 image at a time, and then show a new image on reload or revisit. I've seen past posts in the forum about this, but I'm confused. Down below is the code I've seen, but what do I need to replace in the code? Just the image URLs? And I think it needs to go into code injection > footer? <script> document.addEventListener('DOMContentLoaded', function() { var images = [ 'https://randomwordgenerator.com/img/picture-generator/54e9d1454b5ba914f1dc8460962e33791c3ad6e04e507440752b7edc9649c2_640.jpg', 'https://randomwordgenerator.com/img/picture-generator/50e2dc464e4faa0df7c5d57bc32f3e7b1d3ac3e45658724e77267bd493_640.jpg', 'https://randomwordgenerator.com/img/picture-generator/50e2dc464e4faa0df7c5d57bc32f3e7b1d3ac3e45658724e77267bd493_640.jpg', 'https://randomwordgenerator.com/img/picture-generator/nick-dunlap-h65WkTvyWJY-unsplash.jpg' ].sort( () => .5 - Math.random() ); var randImage = images[0]; document.querySelector(".homepage article.sections section:first-child .section-background img").src = randImage; document.querySelector(".homepage article.sections section:first-child .section-background img").setAttribute("srcset", ""); }); </script> Link to comment
tuanphan Posted June 13 Share Posted June 13 The code will target Homepage First Section Background Image change it to another image on page load. Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment