Randomize thumbnails order in Thumbnail grid
-
wrote on Apr 16, 2020, 5:45 PM last edited by
Hi @mariusjopen
Hope your doing fine in this times of pandemia and isolation.Im trying to randomize the order in my projects Thumbnail grid:
https://www.chamberprojects.com/category/imagesThis are the codes I tried, I know they work becuase i tried them in a jsfiddle, but for some reason they are not working in the grid, maybe you can give me a hint:
<script>
jQuery(function () {
var parent = jQuery(".thumb-collection");
var divs = parent.children();
while (divs.length) {
parent.append(divs.splice(Math.floor(Math.random() * divs.length), 1)[0]);
}
});
</script>OR:
<script>
jQuery(".thumb-collection").php(jQuery(".thumb-collection .thumbnail-wrap").sort(function(){
return Math.random()-0.5;
}));
</script>Thank you!
-
Global Moderatorwrote on Apr 17, 2020, 10:52 AM last edited by mariusjopen Apr 17, 2020, 6:53 AM
Dear @juanpinkus
This is a great idea and we will write it down for the future. Right now this is not possible.Does this code work on JSfiddle?
Thank you!
Marius -
wrote on Apr 22, 2020, 4:11 AM last edited by
Hi @mariusjopen
Thanks for answering. Yes, this codes work on JSfiddle
Here are both examples:
https://jsfiddle.net/epxwy3tz/
http://jsfiddle.net/axphy0gv/I can't figure out why is not woriking on Laytheme, I tried changing the postition of .thumbnial-wrap to "position: static", and add "float: left", but still not working.
I'm missing something and I dont know what it is.
Thank you!
Juan -
its not possible sorry
-
its not possible sorry
wrote on May 7, 2022, 9:14 PM last edited by@arminunruh any update on this functionality? I'm reviving an old post because I think it's better than making a new one just to ask this question. Please remove if against the rules.
-
Dear @Financial
No need to remove this post, happy to talk on older threads 🌝
Randomizing the order of the Thumbnail grid is still not a built in option and will need to be custom coded.
Best
Richard
-
wrote on May 11, 2022, 3:48 PM last edited by Financial May 11, 2022, 11:49 AM
thanks for the reply! any advice on how one would go about custom coding it? is it merely a css issue or...?
-
wrote on May 13, 2022, 10:01 PM last edited by
+1
for this feature!
-
I also code custom websites or custom Lay features.
💿 Email me here: 💿
info@laytheme.com
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it