I'm looking for a way to randomize the order of my Tumblr-posts every time the page is loaded. I found some pieces of code on here, but can't seem to find out where to place them. I don't have any experience with coding, so I'm lost. :)
An example of something I found on here:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
.putauniqueclassnamehere{
}
</style>
<script src="jquery-1.11.2.min.js"></script>
<script>
$(document).ready(function (name) {
return function () {
var max = $(name).length;
$.each($(name), function (p1, p2) {
var randPos = Math.floor(Math.random() * (max - 0 + 1) + 0);
$(p2).insertBefore($(name)[randPos]);
})
return ;
}
}(".putauniqueclassnamehere"))
</script>
</head>
<body>
<div class="mytest">Test 1</div>
<div class="mytest">Test 2</div>
<div class="mytest">Test 3</div>
<div class="mytest">Test 4</div>
<div class="mytest">Test 5</div>
</body>
</html>
This is the blog: https://zinootje.tumblr.com/
Any help is appreciated! Thankyou!
Aucun commentaire:
Enregistrer un commentaire