Jump to content

Simple List - Randomise Items

Recommended Posts

  • Replies 4
  • Views 407
  • Created
  • Last Reply

Top Posters In This Topic

There is no default feature to do this. You will need to use a more complex code (I have no idea).

If you use Summary Block, there is a plugin allow you randomize this. (You can consider using Summary Block, we can give some CSS code to turn Summary Excerpt link to button)

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!)

Link to comment
  • 1 year later...
On 7/8/2024 at 9:20 PM, Beat_Poet said:

I'd be interested as well.

I missed this comment. To make List Simple randomize, you can use this code to Website Tools > Code Injection > Footer.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
    const productGrid = document.querySelector('.user-items-list-simple');
    if (productGrid) {
        var productItems = productGrid.querySelectorAll('.list-item');
        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

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

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.