Opened 9 years ago
Closed 9 years ago
#14895 closed bug (notabug)
using requestAnimationFrame for events such as resize and scroll
Reported by: | yairvsync | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.11.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
quoted from MDN:
Since resize events can fire at a high rate, the event handler shouldn't execute computationally expensive operations such as DOM modifications. Instead, it is recommended to throttle the event using requestAnimationFrame or setTimeout, as follows...
https://developer.mozilla.org/en-US/docs/Web/Reference/Events/resize#Example
I have implemented this method, with some modifications, and it is just awesome. NO ONE should ever use normal events again. they are performance killers.
Note: See
TracTickets for help on using
tickets.
That's a good recommendation for jQuery users to implement in their own code or in plugins.