Simple question really, I'm running a bunch of timeouts but wanna make sure they don't slow the page down and that for some reason they aren't kept in memory after they've executed.
$projects.each(function(index) {
var $this = $(this);
window.setTimeout(function() {
// animate
}, 300 * index);
});
// Clear timeouts?
My guess is that they're destroyed once they've run but just want to follow best practice.
No, you don't. Interval timers (via "setInterval()"), yes, if you want them to stop.
It's harmless to clear a timeout that doesn't have to be cleared. That is, if you do clear one after it has run, browsers won't complain.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With