setTimeout runs only once?

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


        
8条回答
  •  甜味超标
    2020-12-10 10:57

    You only call it once, so it'll only execute once.

    Perhaps you're thinking of "setInterval()".

    When you call it, by the way, just pass the name of the function and not a string:

    setInterval(slide, 3000);
    

提交回复
热议问题