setTimeout runs only once?

前端 未结 8 1621
醉酒成梦
醉酒成梦 2020-12-10 10:43
function slide()
{
    if($(\'.current\').is(\':last-child\')){
        $(\'.current\').removeClass(\'.current\');
        $(\'#imgholder\').first().addClass(\'.curr         


        
8条回答
  •  醉梦人生
    2020-12-10 11:02

    This problem usually happens when you used setTimeout in recursion loop, for example in ajax callback and when you want to run something out of recursion, you expect setTimeout to work as past. remember to use setInterval in non-recursion functions.

提交回复
热议问题