pro Posted November 15, 2021 Share Posted November 15, 2021 I assume you'd need some sorta javascript code to achieve this. If anyone knows the right code, please let me know. Thank you. Beyondspace 1 Link to comment
Beyondspace Posted November 15, 2021 Share Posted November 15, 2021 3 hours ago, alanx said: I assume you'd need some sorta javascript code to achieve this. If anyone knows the right code, please let me know. Thank you. what is your site url Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Lightbox Studio pluginIf you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you Link to comment
pro Posted November 15, 2021 Author Share Posted November 15, 2021 8 minutes ago, bangank36 said: what is your site url steven.squarespace.com Beyondspace 1 Link to comment
Beyondspace Posted November 15, 2021 Share Posted November 15, 2021 1 minute ago, alanx said: https://steven.squarespace.com/clients try document.addEventListener('DOMContentLoaded', function() { const productGrid = document.querySelector('.products-flex-container .list-grid'); if (productGrid) { var productItems = productGrid.querySelectorAll('.grid-item'); for (var i = productItems.length; i >= 0; i--) { productGrid.appendChild(productItems[Math.random() * i | 0]); } } }); Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Lightbox Studio pluginIf you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you Link to comment
Beyondspace Posted November 15, 2021 Share Posted November 15, 2021 1 minute ago, alanx said: Should I insert this code in Advanced > Code Injection > Header? And are there any opening and closing tags? I'm sorry, I'm a little clueless when it comes to JS code. add to footer <script> document.addEventListener('DOMContentLoaded', function() { const productGrid = document.querySelector('.products-flex-container .list-grid'); if (productGrid) { var productItems = productGrid.querySelectorAll('.grid-item'); for (var i = productItems.length; i >= 0; i--) { productGrid.appendChild(productItems[Math.random() * i | 0]); } } }); </script> tuanphan and pro 2 Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Lightbox Studio pluginIf you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you Link to comment
tcrown86 Posted January 27 Share Posted January 27 @Beyondspace are you able to help me out as well please https://adventuresofrico.com/store Thanks Rico Link to comment
tuanphan Posted January 28 Share Posted January 28 22 hours ago, tcrown86 said: are you able to help me out as well please https://adventuresofrico.com/store Thanks Rico Try changing his code to this <script> document.addEventListener('DOMContentLoaded', function() { const productGrid = document.querySelector('.ProductList-grid'); if (productGrid) { var productItems = productGrid.querySelectorAll('.ProductList-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 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
tcrown86 Posted January 28 Share Posted January 28 7 hours ago, tuanphan said: Try changing his code to this <script> document.addEventListener('DOMContentLoaded', function() { const productGrid = document.querySelector('.ProductList-grid'); if (productGrid) { var productItems = productGrid.querySelectorAll('.ProductList-item'); for (var i = productItems.length; i >= 0; i--) { productGrid.appendChild(productItems[Math.random() * i | 0]); } } }); </script> thanks soooo much, worked well. have a great weekend. Link to comment
triodine Posted February 4 Share Posted February 4 @Beyondspace I tried mimicking what you where doing on my site but I seem to be struggling to get it to work. Would you mind giving me a hand as well? https://www.tomaro.com/residential Thanks! Link to comment
Beyondspace Posted February 4 Share Posted February 4 1 hour ago, triodine said: @Beyondspace I tried mimicking what you where doing on my site but I seem to be struggling to get it to work. Would you mind giving me a hand as well? https://www.tomaro.com/residential Thanks! Have you tried my above code yet? It should be added on Home > settings > advanced > code injection, choose the footer Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Lightbox Studio pluginIf you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you Link to comment
triodine Posted February 5 Share Posted February 5 23 hours ago, Beyondspace said: Have you tried my above code yet? It should be added on Home > settings > advanced > code injection, choose the footer I did but it doesn't seem to be working. I think I am trying to call the wrong thing and i'm struggling to figure out what i'm doing wrong. If it isn't too much trouble, would you mind looking at my site and letting me know what I need to fill on my site to get it to work? Link to comment
paul2009 Posted February 5 Share Posted February 5 6 hours ago, triodine said: If it isn't too much trouble, would you mind looking at my site and letting me know what I need to fill on my site to get it to work? This thread is about randomising the order of products in a store, but the link you have provided is for a Gallery, not a store page. About: Squarespace Circle Leader since 2017. I value honesty, transparency, diversity and great design ♥.Work: Squarespace Developer and founder of SF Digital, building the features Squarespace didn't include™. Content: Links in my posts may refer to SF Digital products or may be affiliate links. Catch up on all the release notes and announcements 2023 [for Circle members only]. There's a public version here too!If I helped, you can thank me by clicking one of the emojis below. If you prefer, you can buy me a coffee.Improve your online store with our extensions. Link to comment
triodine Posted February 6 Share Posted February 6 15 hours ago, paul2009 said: This thread is about randomising the order of products in a store, but the link you have provided is for a Gallery, not a store page. Wouldn't the logic be the same? Since a gallery is still a list of images similarly to a list of products on a store page? Link to comment
Beyondspace Posted February 6 Share Posted February 6 7 hours ago, triodine said: Wouldn't the logic be the same? Since a gallery is still a list of images similarly to a list of products on a store page? With your link, you can use the following code <script> document.addEventListener('DOMContentLoaded', function() { const ramdomGrid = document.querySelector('#block-yui_3_17_2_1_1532378835894_3681 .sqs-gallery.sqs-gallery-design-grid'); if (ramdomGrid) { var gridItems = ramdomGrid.querySelectorAll('.slide'); for (let i = gridItems.length; i >= 0; i--) { ramdomGrid.appendChild(gridItems[Math.random() * i | 0]); } } }); </script> Support me by pressing 👍 or marking as solution if this useful for you Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Lightbox Studio pluginIf you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you 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