I am trying to make a image gallery and i am using a for loop to load all the images. but now I have the problem that it is going fast so I want to delay the the loop each time.
I tried to set a timeout but that does not work
does somebody know how to delay the loop with Jquery.
js code:
function test(){
var src = 'img/nature/';
var img = ['1.jpg'];
var image = [ "1.jpg", "2.jpg", "3.jpg",'4.jpg','5.jpg','6.jpg','7.jpg' ];
for ( var i = 0; i < image.length; i = i + 1 ) {
$('#frame').append('<img class="tile hide" src="'+src + image[ i ]+ '">');
$('.hide').show(500);
setTimeout(function(){
},500);
}
}
And I have a other question. Is it possible to load all the imags in a folder using Jquery?