基于jq 滚动条到底加载更多的方法

来源:互联网 发布:内部优惠券提取软件 编辑:程序博客网 时间:2024/06/06 05:24

方法如下,可自行添加加载动画

var page=1;var is_load=true;function getAllBrand_more(){//滚动条到底部加载更多page+=1;is_load=false;jsonAjax(API.API_LIST.SHOP_DETAIL,{'userid':userid,'page':page,},function(data){if(data.status==1){doTAppend(data,$('#ShopAll'));is_load=true;}});}$('body').on('touchmove',function(e){var windowHeight= document.documentElement.clientHeight;varscrollTop = $('body').scrollTop();  //滚动距离  varscrollHeight = $(document).height(); //文档总高度// console.log(scrollTop,windowHeight,scrollHeight);if(scrollTop + windowHeight >= scrollHeight-50){if(is_load){getAllBrand_more();}else{return;}}});


0 0
原创粉丝点击