Javascript setTimeout function repeat

前端 未结 3 1625
走了就别回头了
走了就别回头了 2020-12-21 12:26

Is there a way to repeat a function in Javascript using the setTimeout function? For example, I need two functions to be called every five seconds. I have something like thi

3条回答
  •  猫巷女王i
    2020-12-21 13:06

    Every x seconds can be done with setInterval:

    $(document).ready(function(){    
      setInterval(function(){
        shiftLeft(); showProducts();
      }, 5000);    
    });
    

提交回复
热议问题