您的位置:首页 > 其它

滚到底部自动加载 像新浪微博那样,

2013-03-22 10:53 253 查看
<script>
if(true){
jQuery(function(){
var m = window.location.search.match(/p=(\d+)/);
var curPage = m ? parseInt(m[1]) : 1;
var loading = false;

jQuery("#content").scroll(function(){
if ( curPage >= 1 && !loading && this.scrollHeight -
this.scrollTop - this.offsetHeight < this.offsetHeight ) {
loading = true;
if ((25*curPage) < 79346) {
DWRUtil.setValue("scrollStats", 25*(curPage+1) + " of " + 79346);
} else {
DWRUtil.setValue("scrollStats", 79346);
}
$("progressIndicator").style.display="block";
jQuery.ajax({
type: "GET",
dataType: "html",
url: window.location + (window.location.search != '' ? "&" : "?") + "type=html&p=" + ( ++curPage ),
success: function( html ){
html = jQuery.trim( html );

if ( html ) {
jQuery("#content-inner").append( html );

//                             }
} else
curPage = 0;
},
complete: function(){
loading = false;
//                         alert(window.location.pathname + (window.location.search != '' ? ""+ window.location.search +"&" : "?") + "p=" + ( curPage ))
pageTracker._trackPageview(window.location.pathname + (window.location.search != '' ? ""+ window.location.search +"&" : "?") + "p=" + ( curPage ));
_qacct="p-ebK_XdQH1HeLo"; quantserve();
$("progressIndicator").style.display="none";
}
});
}
});
});
}
</script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: