Created
June 23, 2013 01:31
-
-
Save jveldboom/5843368 to your computer and use it in GitHub Desktop.
Simple Content Load on Scroll
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 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; | |
}); | |
} | |
} | |
}); | |
// Update code, simple add or integrate this. | |
$(document).ready(function() { | |
$('#loaded_max').val(50); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment