Answer the question
In order to leave comments, you need to log in
How to loop a function in jQuery duration and interval?
Is it possible to loop functions in jQuery.
The task is to add a class to an element, after "N" seconds to remove the previously added class, and so that this process is looped with an interval of "N" seconds. Found setInterval and setTimeout just how to combine it into code, or maybe there are easier / more correct options?
ps I'm completely new to JS/JQuery, please help anyone who can ))) Thank you.
Answer the question
In order to leave comments, you need to log in
var N = 5000; // 5 секунд
setInterval(function(){
$('#targetBlock').toggleClass('className');
}, N);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question