請教一下瀑布加載完如何讓按鈕不消失?【加載更多】文字改為【內(nèi)容已經(jīng)加載完成】
var Mpage=1;
//滾動顯示更多
var scroll_get = true; //做個標(biāo)志,不要反反復(fù)復(fù)的加載
$(document).ready(function () {
$(window).scroll(function () {
if (scroll_get==true && (400 + $(window).scrollTop())>($(document).height() - $(window).height())) {
scroll_get = false;
layer.msg('內(nèi)容加截中,請稍候',{time:1000});
dr_ajax_load_more();
}
});
});
function dr_ajax_load_more(){
Mpage++;
$.get('/index.php?s=api&c=api&m=template&name=list_data.html&module={MOD_DIR}&catid={$catid}&format=json&page='+Mpage+'&'+Math.random(),function(res){
$('.footer-cont').hide();
if(res.code==1){
if(res.msg==''){
//這里的判斷條件需要結(jié)合list_data.html模板來寫,否則會出現(xiàn)無限的加載了
layer.msg("已經(jīng)顯示完了",{time:500});
}else{
$('#content_list').append(res.msg);
scroll_get = true;
}
}else{
layer.msg(res.msg,{time:2500});
}
}, 'json');
}<div class="ajax_btn margin-top-20" id="is_ajax_btn"> <a href="javascript:dr_ajax_load_more();" class="btn default btn-block"> 加載更多 </a> </div>
layer.msg("已經(jīng)顯示完了",{time:500});
$("#is_ajax_btn .btn").html("已加載完成");
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!