N
N
n1ksON2020-05-02 18:11:11
JavaScript
n1ksON, 2020-05-02 18:11:11

How to make the execution of a function infinite with a delay?

You need to make a slider like on the main zoom page. Where it is written about clients. To make 5 logos disappear and 5 appear. And so constantly.
Final variant. It is necessary to make the infinite execution of the function with a delay.

for (let i = 5; i < 0; i++) {
        $('.carousel__first').toggle('1000');
        $('.carousel__second').toggle('1000');
}

But it doesn't work. Perhaps you need to add the execution of the function to the queue? Or some other way? Thank you in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Arseny, 2020-05-02
@n1ksON

https://learn.javascript.ru/settimeout-setinterval
In addition to cyclicity, they can be written to a variable and cleared.

T
Tranceinheart, 2020-05-02
@Tranceinheart

setInterval(function(){
//your code here
}, 1000);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question