Skip to content

Instantly share code, notes, and snippets.

@loorlab
Created May 13, 2015 04:50
Show Gist options
  • Save loorlab/6345d727becdb75f5155 to your computer and use it in GitHub Desktop.
Save loorlab/6345d727becdb75f5155 to your computer and use it in GitHub Desktop.
Random DIV with jQuery 2.1.3 DEMO : http://jsfiddle.net/jBzB4/118/
HTML
<div id="container-mov">
<div id="cammov1" class="swiper-slide">SLIDE 1</div>
<div id="cammov2" class="swiper-slide">SLIDE 2</div>
<div id="cammov3" class="swiper-slide">SLIDE 3</div>
<div id="cammov4" class="swiper-slide">SLIDE 4</div>
<div id="cammov5" class="swiper-slide">SLIDE 5</div>
<div id="cammov6" class="swiper-slide">SLIDE 6</div>
</div>
JS
var divsCollection = $("#container-mov");
var container = $(divsCollection).find('.swiper-slide');
var divs = container.get().sort(function(){
return Math.round(Math.random());
});
$(divsCollection).html(divs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment