/ Published in: jQuery
Usage:
$(".parent-element").shuffleChildren();
$(".parent-element").shuffleChildren();
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$.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);� � }); };