Jump to content

Randomise the order of images in a gallery on refresh (version 7.1)

Recommended Posts

Site URL: https://salmon-capybera-psd8.squarespace.com/



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,


Edited by Billyb
Link to comment
  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

  • 1 year later...
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>
 $( document ).ready(function() {
 (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);
           for(var i=0; i < elems.length; i++) {
} });


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

Create an account or sign in to comment

You need to be a member in order to leave a comment

  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.