php更多加载...
2016-02-26 14:14
621 查看
$('#more_load').bind('click',function(){
$.get('/index.php/milestone_ajax',{page: pageid},function(data){
$('#ajax').html(data);
if($('#ajax dl').length < 2){
$('#more_load').unbind('click');
$('.more_load_outter').fadeOut();
}
pageid++;
$('#charity_box .inner').append($('#ajax').html()).parent().animate({height:$('#charity_box .inner').height()+$('#charity_box').height()},function(){
$('#charity_box').append($('#charity_box .inner').html());
$('#charity_box .inner').html('');
});
$('#ajax').html('');
})
});
$.get('/index.php/milestone_ajax',{page: pageid},function(data){
$('#ajax').html(data);
if($('#ajax dl').length < 2){
$('#more_load').unbind('click');
$('.more_load_outter').fadeOut();
}
pageid++;
$('#charity_box .inner').append($('#ajax').html()).parent().animate({height:$('#charity_box .inner').height()+$('#charity_box').height()},function(){
$('#charity_box').append($('#charity_box .inner').html());
$('#charity_box .inner').html('');
});
$('#ajax').html('');
})
});
<script> | |
var loading = $('.loading'); | |
var loadmore = $('.loadmore'); | |
var page = 0; | |
var pagecount = 326095/ 15; | |
$(function () { | |
var winHeight = $(window).height(); | |
$(window).on('scroll', function () { | |
var scrollTop = $(this).scrollTop(); | |
var diff = $(document).height() - winHeight - scrollTop - 50; | |
if (diff < 0 && page < 3) { | |
getmore(); //动态加载内容 | |
} | |
}); | |
}); | |
function getmore() { | |
page = page + 1; | |
if (page <= pagecount) { | |
var url = "http://m.admin5.com/getmore/0/1/" + page + "?flag_id=648902"; | |
loading.show(); | |
loadmore.hide(); | |
$.ajax({ | |
type: "GET", | |
url: url, | |
success: function (data) { | |
$(".ul_list").append(data); | |
loading.hide(); | |
loadmore.show(); | |
}, | |
error: function (XMLHttpRequest, textStatus, errorThrown) { | |
loading.hide(); | |
loadmore.html("网络异常,请检查后重试!"); | |
loadmore.show(); | |
} | |
}); | |
} else { | |
loading.hide(); | |
loadmore.html("没有了"); | |
loadmore.show(); | |
} | |
return false; | |
} | |
</script> | |
<!--统计--> |
相关文章推荐
- PHP关于上传的有关配置
- exit()与die()在PHP中的区别
- PHP反射(ReflectionClass、ReflectionMethod)在ThinkPHP框架的控制器调度模块中的应用
- netperf的安装及使用
- SAS Macro STPBEGIN
- PHP如何实现文件上传
- Yii去掉index.php?r=
- partprobe命令用法
- php随机字符串
- php+js 瀑布流源码
- PHPExcel导入导出Excel文件
- cookie 和 session 的关系
- php 截取字符段长度 方法
- PHP文件缓存smarty模板应用实例分析
- php-fpm配置
- how to setup php running environment on osx
- 慕课网----大话PHP设计模式 六(面向对象编程的基本原则,自动加载config)
- 高质量PHP代码的50个实用技巧:非常值得收藏
- PHP计算当前坐标3公里内4个角落的最大最小经纬度实例
- php六种基础算法:冒泡,选择,插入,快速,归并和希尔排序法