Skip to content

Instantly share code, notes, and snippets.

@swape
Created January 8, 2014 12:35
Show Gist options
  • Save swape/8316174 to your computer and use it in GitHub Desktop.
Save swape/8316174 to your computer and use it in GitHub Desktop.
This script calls a function when scrolling 90px from end of the screen.
var mLock = true;
$(window).scroll(function(){
if (document.body.scrollHeight <= document.body.scrollTop + window.innerHeight + 90 ){
if(mLock){
mLock = false;
doSomeFunction();
}
}
});
doSomeFunction(){
// crazy loading content via ajax and stuff
mLock = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment