Billyb Posted January 7, 2022 Share Posted January 7, 2022 (edited) Site URL: https://salmon-capybera-psd8.squarespace.com/ Hello, I appreciate someone has asked this last year but it appears to have been forgotten about and looks unresolved anyway. I would like to randomise the order of the images in my gallery. There is a plugin but it only works on image blocks in 7.1. Any help with the code would be very much appreciated! https://salmon-capybera-psd8.squarespace.com/ password is test Thank you, Billy Edited January 7, 2022 by Billyb Link to comment
tuanphan Posted January 8, 2022 Share Posted January 8, 2022 For Gallery Section on Homepage? 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
Billyb Posted January 8, 2022 Author Share Posted January 8, 2022 Yes I have multiple galleries in Strips and would like the images to randomise on refresh Link to comment
shopkisme Posted February 28 Share Posted February 28 @billyb It appears that you found a solution. Could you help point me in the right direction? I am trying to do exactly what your homepage does. Link to comment
tuanphan Posted March 6 Share Posted March 6 On 3/1/2023 at 5:44 AM, shopkisme said: @billyb It appears that you found a solution. Could you help point me in the right direction? I am trying to do exactly what your homepage does. He used Gallery Section then add this to Settings > Advanced > Code Injection > Footer <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script> <script> $( document ).ready(function() { $('.gallery-strips-wrapper').randomize('.gallery-strips-item'); }); (function($) { $.fn.randomize = function(childElem) { function shuffle(o) { for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x); return o; }; return this.each(function() { var $this = $(this); var elems = $this.children(childElem); shuffle(elems); $this.detach(childElem); for(var i=0; i < elems.length; i++) { $this.append(elems[i]); } }); } })(jQuery); </script> 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