//loading $(document).on("click", "#btn_loading", function() { var cookiepage = getcookie('loadpage') ? getcookie('loadpage') : '0'; var loadednum = $('#news_list').children('li').length; var newpage = Math.ceil(loadednum/10) + 1; var thepage = $('#news_list').attr('data-page') ? $('#news_list').attr('data-page') : newpage; if(parseInt(cookiepage) < parseInt(thepage)){ ajaxRead(thepage); setcookie('loadpage',thepage,'1'); }else{ ajaxRead(newpage); } }); setcookie('loadpage','0','1'); function show(){ if($(window).scrollTop()+$(window).height()+20>=$(document).height()){ var cookiepage = getcookie('loadpage') ? getcookie('loadpage') : '0'; var loadednum = $('#news_list').children('li').length; var newpage = Math.ceil(loadednum/10) + 1; var thepage = $('#news_list').attr('data-page') ? $('#news_list').attr('data-page') : newpage; if(parseInt(cookiepage) < parseInt(thepage)){ ajaxRead(thepage); setcookie('loadpage',thepage,'1'); }else{ } } }; function ajaxRead(page){ var html=""; var loadednum = $('#news_list').children('li').length; var newpage = Math.ceil(loadednum/10) + 1; var thepage = $('#news_list').attr('data-page') ? $('#news_list').attr('data-page') : newpage; var page = thepage; var thenum = $('#news_list').attr('data-num') ? $('#news_list').attr('data-num') : '0'; thenum = parseInt(thenum); page = parseInt(page); $.ajax({ type:'get', dataType:'json', url:'https://m.csvii.com/index.php?m=content&c=index&a=m_ajaxlists&catid=13&page='+page, beforeSend:function(){}, success:function(data){ //alert(obj2string(data)); //$('.section-hotchannel').next('.section-show').html(obj2string(data)).css('height','200px').css('overfllow','hidden'); if(obj2string(data) != '{}'){ $('#news_list').attr('data-load','ture'); $.each(data,function(i,item){ if(item.thumb1 && item.thumb2 && item.thumb3){ html+='
  • '; html+=''; html+='
    '; html+='

    '+item.title+'

    '; html+='
    '; html+='
    '+item.title+'
    '; html+='
    '+item.title+'
    '; html+='
    '+item.title+'
    '; html+='
    '; html+='
    '+date('Y-m-d H:i:s',item.addtime)+'
    '; html+='
    '; html+='
    '; html+='
  • '; }else{ if(item.thumb){ html+='
  • '; html+=''; html+='
    '+item.title+'
    '; html+='
    '; html+='

    '+item.title+'

    '; html+='
    '+date('Y-m-d H:i:s',item.addtime)+'
    '; html+='
    '; html+='
    '; html+='
  • '; }else{ html+='
  • '; html+=''; html+='
    '; html+='

    '+item.title+'

    '; html+='

    '+item.description+'

    '; html+='
    '+date('Y-m-d H:i:s',item.addtime)+'
    '; html+='
    '; html+='
    '; html+='
  • '; } } thenum = thenum +1; $('#news_list').attr('data-num',thenum); }); $('#news_list').attr('data-load','true'); page = page + 1; //alert(page); $('#news_list').attr('data-page',page); $('#news_list').append($(html)); }else{ $('#news_list').attr('data-load','false'); $('#btn_loading').html('暂无更多的数据了'); return false; } }, complete:function(){ var theload = $('#news_list').attr('data-load') ? $('#news_list').attr('data-load') : 'true'; if(theload == 'true'){ }else{ $('#btn_loading').html('暂无更多的数据了'); } } }); }