Clicking “start multiple intervals” below will start two intervals running that update every 5 seconds. The unique timer ids are the values returned by the setInterval function.
Clicking “clear all intervals” will clear all running intervals.
To clear a specific interval, you need to use that interval’s unique timer id. Clear each interval individually using their corresponding buttons.
The original post explaining in detail is here.
Pingback: Handling multiple timers with JavaScript’s setInterval and jQuery |
this is a great post, very close to what I am looking for. I want to timers or intervals, but I want the second one delayed and I want them both to end at the same time. so content 1 will change every 10 seconds, content 2 will delay 5 seconds and last for 5 seconds. but I am struggling with the delay and timer