inherit
211778
0
Aug 3, 2016 11:36:21 GMT -8
ponzinomics
250
July 2014
ponzinomics
|
Post by ponzinomics on Jul 24, 2014 11:25:58 GMT -8
As suggested here, I am opening this functionality request. Currently news looks to be shown in ordered way. The request would be optionally showing the news in a random way. This is just to prevent that the user sees always the same sequence of news whenever he reloads the page. It would be nicer news showing randomly. Thanks
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Jul 24, 2014 16:51:29 GMT -8
Drop the following code at the bottom of your home layout template and see if it produces the requested randomization:
<script type="text/javascript"> (function () { var headlinesContainer = $('#news .items'), headlines = (function NaiveShuffle(arr) { //jsperf.woohoo var i, temp, j, len = arr.length; for (i = 0; i < len; i++) { j = ~~(Math.random() * len); temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } return arr; })($('div', headlinesContainer).each(function (i, e) { $(e).attr('data-news-index', 'News Headline #' + i); })) headlines.detach().appendTo(headlinesContainer); })() </script>
|
|
inherit
211778
0
Aug 3, 2016 11:36:21 GMT -8
ponzinomics
250
July 2014
ponzinomics
|
Post by ponzinomics on Jul 24, 2014 21:50:51 GMT -8
It does Eton, brilliant.
Adolfo
|
|