air
air

Reputation: 6264

change image after timeout

i have following code

   <div class="caption" style=" position:absolute; margin-top:0px">
   <img src="caption/img1.png" />
   </div>


 <script>
$(document).ready(function(){     
setTimeout(function() {
$('div.caption').fadeOut('slow');
$('div.caption').fadeIn();
}, 1000);

});

but this work only once, what i want to do is after every 1000ms function should run and change image in div "caption" i have image series and i can put their names in array.

Upvotes: 0

Views: 961

Answers (2)

geowa4
geowa4

Reputation: 41833

setInterval takes the same arguments as setTimeout but it executes the function every n milliseconds, as specified. see more here

Upvotes: 0

Roberto Aloi
Roberto Aloi

Reputation: 30995

You can try the following:

http://malsup.com/jquery/cycle/

Upvotes: 1

Related Questions