Skip to content

Instantly share code, notes, and snippets.

@edwinwebb
Created June 17, 2015 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save edwinwebb/5367024f96d056e462c7 to your computer and use it in GitHub Desktop.
Save edwinwebb/5367024f96d056e462c7 to your computer and use it in GitHub Desktop.
JS Test Two
// The expensive animation is causing performance issues. Write the function 'yourFunction' that reduces calls to the animation.
function scrollHandler() {
var items = document.querySelectorAll('.list-item');
var i = 0;
var len = items.length;
for(; i < len; i++) {
// perform expensive animation
}
}
window.addEventListener('scroll', yourFunction(scrollHandler));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment