开发者

change image after timeout

开发者 https://www.devze.com 2022-12-09 14:31 出处:网络
i have following code <div class=\"caption\" style=\" position:absolute; mar开发者_JAVA百科gin-top:0px\">

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

0

精彩评论

暂无评论...
验证码 换一张
取 消