ColinMaloneArt Posted November 2 Posted November 2 (edited) Hello, I have an animated gallery display block on my homepage and I was hoping to randomize the order of the images within so that my viewers are treated to different images when they visit my website. My url is https://www.colinmalone.com Thank you! Edited November 2 by ColinMaloneArt
tuanphan Posted November 28 Posted November 28 @ColinMaloneArt You can use this code to Website Tools > Code Injection > Footer <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <script> $(document).ready(function () { var $slideshow = $('body.homepage .gallery-fullscreen-slideshow-list'); var $slides = $slideshow.children(); $slides.css({ visibility: 'hidden', display: 'none' }); var randomSlide = $slides.eq(Math.floor(Math.random() * $slides.length)); randomSlide.css({ visibility: 'visible', display: 'block' }); }); </script> Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment