javascript - Showing random divs images every time page is load -


lets have these images gallery, how randomly display images everytime when reload page?

http://creativepreviews.com/fiddle/study/20131007/

you along these lines (not tested)

var grd = $('#grid'); var imgs = grd.children(); imgs.sort(function(){return (math.round(math.random()) - 0.5);}); grd.remove('li'); for(var i=0;i < imgs.length;i++) grd.append(imgs[i]); 

in essence doing getting li elements in 'grid' array, randomizing them, removing them 'grid' , putting them in again.

if had supplied working fiddle rather link finished article easier modify , provide more complete solution.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -