Created
August 18, 2015 03:12
-
-
Save msrafi/3f7eb971ccf470781537 to your computer and use it in GitHub Desktop.
From http://joshbroton.com/hooking-up-to-the-window-onscroll-event-without-killing-your-performance/
This file contains 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
var didScroll = false; | |
window.onscroll = doThisStuffOnScroll; | |
function doThisStuffOnScroll() { | |
didScroll = true; | |
} | |
setInterval(function() { | |
if(didScroll) { | |
didScroll = false; | |
console.log('You scrolled'); | |
} | |
}, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment