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
-
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
-
-
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login