我已成功使用以下代码创建自动加载内容:
<script type="text/javascript">
$(document).ready(function() {
var track_load = 0; //total loaded record group(s)
var loading = false; //to prevents multipal ajax loads
var total_groups = <?php echo $total_groups; ?>; //total record group(s)
$('#results').load("autoload_process.php", {'group_no':track_load}, function() {track_load++;}); //load first group
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() == $(document).height()){
if(track_load <= total_groups && loading==false){
loading = true; //prevent further ajax loading
$('.animation_image').show();
$.post('autoload_process.php',{'group_no': track_load}, function(data){
$("#results").append(data);
$('.animation_image').hide();
track_load++; //loaded group increment
loading = false;
}).fail(function(xhr, ajaxOptions, thrownError) {
alert(thrownError); //alert with HTTP error
$('.animation_image').hide(); //hide loading image
loading = false;
});
}
}
});
});
</script>
你可以帮我制作像portofolio这样的网格风格吗?
喜欢这个网站:http://www.clear.co.id/