Arranges way HTML Ally Random By Jquey
In the project “www.cuocsongmoi.vn” I met pretty much required’ve never met before, in that sort of business employees to random interests of employees equally.
My list of employees is listed as the <ul>, the key is random list element (<li>) at random after each refesh again.
The first example I have a great list of personnel categorized as follows:
Full jQuery code to perform the following tasks:
$(document).ready(function(){
$('#list-chat').randomize('li');
});
// function random supportor
$.fn.randomize = function(selector){
var $elems = selector ? $(this).find(selector) : $(this).children(),
$parents = $elems.parent();
$parents.each(function(){
$(this).children(selector).sort(function(){
return Math.round(Math.random()) - 0.5;
// }). remove().appendTo(this); // 2014-05-24: Removed `random` but leaving for reference. See notes under 'ANOTHER EDIT'
}).detach().appendTo(this);
});
return this;
};
you did not? is it true? things too easy.