Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type='text/javascript'>
- //<![CDATA[
- // Random order to Popular Posts using jQuery / MS-potilas 2011
- // Put this code in a html/javascript gadget or before </body>.
- // See http://yabtb.blogspot.com/2011/12/shuffle-blogger-popular-posts.html
- var ul = $('.popular-posts ul');
- var lis = $('.popular-posts ul li');
- if(lis.length>1) {
- for(var i=lis.length-1;i;i--) { // fisher-yates/knuth
- var j=parseInt(Math.random()*i);
- lis[j] = lis.splice(i,1,lis[j])[0]; // swap lis[i]&lis[j]
- }
- lis.appendTo(ul);
- }
- //]]>
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement