tumblr - Html code for displaying posts in random order -
i have created tumblr blog shows photos of interest. looking have tumblr photo posts displayed in random order such every-time page loaded, order of posts in grid theme randomly shown. way can see posts without scrolling.
does know code can insert theme posts shown in random order , shown in random order every time page loads.
i not entirely familiar tumbler, willing bet there unique class name image blocks. can insert javascript on tumbler well. see: http://www.problogtricks.com/2013/12/add-custom-css-javascript-code-to-tumblr-blog.html
that said, randomizing elements javascript super easy. here demo of how done. after identifying unique classname applies elements, can change parameter inside javascript function below.
<!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>
Comments
Post a Comment