Skip to content

Instantly share code, notes, and snippets.

@junkafarian
Forked from edwinwebb/test-two.js
Last active August 29, 2015 14:23
Show Gist options
  • Save junkafarian/ae85ab28c2288e21b4ca to your computer and use it in GitHub Desktop.
Save junkafarian/ae85ab28c2288e21b4ca to your computer and use it in GitHub Desktop.
// 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