How do i fix setInterval and setTimeout lag? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do i fix setInterval and setTimeout lag?

I am working on website containing some setIntervals and setTimeouts to slowly the CSS of some elements. But when I switch up tabs the browser (stops the functioning of them for the time i return back to the tab containing website) causes a lag in their functions which seems to completely mess up the look of my webpage. Is there anyway I can fix it? Or will I have start from scratch again?

15th Jul 2017, 4:40 AM
Avi_Roy
Avi_Roy - avatar
2 Answers
0
I suggest that you use CSS transitions or animations instead.
15th Jul 2017, 4:51 AM
Luca Garrera
0
I have tried using them but the result was better with setInterval and setTimeout. But if there is no way to fix it then I think I will have to use CSS instead 🤔. Thanx btw.
15th Jul 2017, 5:25 AM
Avi_Roy
Avi_Roy - avatar