Skip to content

Instantly share code, notes, and snippets.

@ramiabraham
Created May 18, 2013 09:19
Show Gist options
  • Save ramiabraham/5603837 to your computer and use it in GitHub Desktop.
Save ramiabraham/5603837 to your computer and use it in GitHub Desktop.
jquery load content on scroll
var loading = false;
$(window).scroll(function(){
if((($(window).scrollTop()+$(window).height())+250)>=$(document).height()){
if(loading == false){
loading = true;
$('#loadingbar').css("display","block");
$.get("load.php?start="+$('#loaded_max').val(), function(loaded){
$('body').append(loaded);
$('#loaded_max').val(parseInt($('#loaded_max').val())+50);
$('#loadingbar').css("display","none");
loading = false;
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment