Created
June 17, 2015 13:14
-
-
Save edwinwebb/5367024f96d056e462c7 to your computer and use it in GitHub Desktop.
JS Test Two
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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