Run JavaScript function at regular time interval

前端 未结 4 447
悲哀的现实
悲哀的现实 2020-11-28 13:02

I am currently building a website to host software. What I want is to add to the project pages is a slideshow of screenshots cycling, changing images about every 5 seconds.

4条回答
  •  伪装坚强ぢ
    2020-11-28 13:46

    You can use window.setInterval

    Sample usage:

    window.setInterval(function () {
        console.log("foo");
    }, 3000);
    

提交回复
热议问题