Created
March 9, 2016 23:29
-
-
Save jacopotarantino/724b277a0bea5e513e7c to your computer and use it in GitHub Desktop.
Randomly sort children of a div using jQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.jQuery(function () { | |
'use strict'; | |
var $parent = $('.gallery-grid-fullwidth'); | |
$('> *', $parent) | |
.sort(function () { | |
return ( Math.round( Math.random() ) - 0.5 ) | |
}) | |
.appendTo($parent); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
document.ready
event.