Random image display from a folder
I want to do a image slider in my dotnet nuke project. Ie want to display image one after other. Is there is any free module for that? or Is there is any way to display(one 开发者_C百科after another like slide show) all the images from a folder using java script or jquery?
Thanks in advance
use dnn's inbuild widgets to do so: take a look at this page and find RotatorWidget
var divs = $("div.Image").get().sort(function(){
return Math.round(Math.random())-0.5; //so we get the right +/- combo
}).slice(0,4);
$(divs).show();
If you want to also randomize the order (not just which are shown), you already have them sorted so just append them to the same parent in their new order by changing this:
$(divs).show();
//to this:
$(divs).appendTo(divs[0].parentNode).show();
精彩评论