Sekoita lapsia CSS-temppuja

Anonim
$.fn.shuffleChildren = function() ( $.each(this.get(), function(index, el) ( var $el = $(el); var $find = $el.children(); $find.sort(function() ( return 0.5 - Math.random(); )); $el.empty(); $find.appendTo($el); )); );

Käyttö

$(".parent-element").shuffleChildren();

Katso
Chris Coyierin (@chriscoyier) kynän jQuery-sekoitustoiminto
CodePenistä.