I
I
Ivan Erokhin2018-02-08 23:07:55
JavaScript
Ivan Erokhin, 2018-02-08 23:07:55

How to loop block style changes with delays?

Wrote a simple "carousel", how to make auto scroll?
You need to loop several commands with a delay.

For example, here are the commands that change slides:

$(slide).removeClass('card slide_active');
$(slide).addClass($(target_).attr('class'));
$(target_).attr('class', '');
$(target_).addClass('card slide_active');


The styles of two slides change, although this is not very important in this matter.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valery Alekseev, 2018-02-09
@dero

It is set through the standard JS function - setInterval ().
Sketched a simple example -  https://codepen.io/anon/pen/MQJGGm

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question