3 ms·
In addition to everyone else's comments, there's another big problem: browsers treat setTimeout delays as very loose suggestions. If you're scrolling when one
by exogen 8y ago
In addition to everyone else's comments, there's another big problem: browsers treat setTimeout delays as very loose suggestions.
If you're scrolling when one of these timeouts is set, or one starts and then you start scrolling, it's possible for the browser to delay the callback for a super noticeable amount of time, on the order of 3–10 seconds (about a thousand times slower than you intended).