Randomize thumbnails order in Thumbnail grid
-
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!
-
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 -
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
-
@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
-
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