You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I neither faced any performance issues myself nor did I run extensive benchmarks on what I'm suggesting.
The points do not come from my personal experience either, some are even rather hearsay so take it with a grain of salt.
During scrolling it looks like you j-query both the elements and the body just to use the jQuery methods .scrollTop() and .offset(). Vanilla JS might bring performance gains here.
In recurse you also j-query each element and then use .css() to access their display style. Plain vanilla JSshould also be more performant here.
In elementInViewport you walk up the parent chain. getBoundingClientRect() should usually be more performant.
I did see JSPerfs supporting these claims at least on my machine and current browser so I might (or might not) add them here later.
Again: I neither reviewed those JSPerfs, nor did I run them on multiple browsers or devices, nor did I performance-test in the context of your code.
The text was updated successfully, but these errors were encountered:
I neither faced any performance issues myself nor did I run extensive benchmarks on what I'm suggesting.
The points do not come from my personal experience either, some are even rather hearsay so take it with a grain of salt.
.scrollTop()
and.offset()
. Vanilla JS might bring performance gains here.recurse
you also j-query each element and then use.css()
to access theirdisplay
style. Plain vanilla JSshould also be more performant here.elementInViewport
you walk up the parent chain.getBoundingClientRect()
should usually be more performant.I did see JSPerfs supporting these claims at least on my machine and current browser so I might (or might not) add them here later.
Again: I neither reviewed those JSPerfs, nor did I run them on multiple browsers or devices, nor did I performance-test in the context of your code.
The text was updated successfully, but these errors were encountered: