change image after timeout
i have following code
<div class="caption" style=" position:absolute; mar开发者_JAVA百科gin-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.
You can try the following:
http://malsup.com/jquery/cycle/
setInterval
takes the same arguments as setTimeout
but it executes the function every n milliseconds, as specified. see more here
精彩评论