Side navigation
#14895 closed bug (notabug)
Opened March 18, 2014 02:36PM UTC
Closed March 18, 2014 03:55PM UTC
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.
Attachments (0)
Change History (1)
Changed March 18, 2014 03:55PM UTC by comment:1
resolution: | → notabug |
---|---|
status: | new → closed |
That's a good recommendation for jQuery users to implement in their own code or in plugins.