Jump to content

Images to appear in random order?

Go to solution Solved by tuanphan,

Recommended Posts

  • Solution

Try adding to Settings > Advanced > Code Injection > Footer

<script>
document.addEventListener('DOMContentLoaded', function() {
    const productGrid = document.querySelector('.gallery-masonry .gallery-masonry-wrapper');
    if (productGrid) {
        var productItems = productGrid.querySelectorAll('figure');
        for (var i = productItems.length; i >= 0; i--) {
            productGrid.appendChild(productItems[Math.random() * i | 0]);
        }
    }
});
</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
  • Eunice_SQSP changed the title to Images to appear in random order?
  • 1 month later...
On 5/23/2023 at 5:16 PM, mportch said:

Hi,

The images on DESKTOP version still click to a new window. But they no longer click to a new window on MOBILE version. Do you know how to fix this?

https://smilodon-ocelot-my5f.squarespace.com/gallery

 

You have this code in Code Injection or Page Header, it disabled click event

 <style>
            @media screen and (max-width: 767px) {
                #page .gallery a {
                    pointer-events: none;
                }
            </style>

 

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.