'; html += ''; } $("#topHtml").html(html); } }); } makeTop(); //移动端腰带 var pageId = ''; pageId = $("#wrapper03 .img a").eq(0).attr('pageId'); if(typeof pageId =="undefined" || pageId==''){ pageId = ''; var aList = $("#wrapper03 .img a"); for(var i=0 ; i0){ pageId = pageId.substring(0, pageId.length-1); } } var mobileYD1 = pageId; var mobileYD2 = 'PAGEXiHyb00IG6aaBlJyh6do190619'; var mobileYD3 = 'PAGEwscuo8BgMtTD0zJpO6QO190701'; function makeMobileYD(pageId,id){ var url = '//api.cntv.cn/NewArticle/getArticleListByPageId?serviceId=pcnews&id=${pageId}&level=81&t=jsonp&cb='+id; url = url.replace('${pageId}',pageId); if(id!='mobileYD1'){ //腰带第二和第三条数据,不需要判断level url = url.replace('&level=81',''); } $.ajax({ url: url, type: 'get', dataType: 'jsonp', jsonp:'cb', jsonpCallback: id, cache:true, success:function(data){ var list = data.data.list; var html = ''; var row = null; if(id!='mobileYD1'){ row = list[0]; }else{ row = list[1]; } html += '
'; html += '

'+row.title+'

'; $("#"+id).html(html); } }); } var curPage = 1; var pageSize= 8; var pageSize1=9; //切换数据 $("#wrapper03 .img a").click(function(){ $("#wrapper03 .img a").each(function(){ $(this).find('img').hide(); $(this).find('img').eq(0).show(); }); $(this).find('img').hide(); $(this).find('img').eq(1).show(); pageId = $(this).attr('pageId'); if(typeof pageId =="undefined" || pageId==''){ pageId = ''; var aList = $("#wrapper03 .img a"); for(var i=0 ; i0){ pageId = pageId.substring(0, pageId.length-1); } } $('.kuaikan18839_ind05 .more').html(''); jiazaizhong = true curPage = 1; var url = '//api.cntv.cn/NewArticle/getArticleListByPageId?serviceId=pcnews&id=${pageId}&s=0&n='+pageSize1; url = url.replace('${pageId}',pageId); $.ajax({ url: url, type: 'get', dataType: 'jsonp', jsonp:'cb', jsonpCallback: 'cb2', cache:true, success:function(data){ var list = data.data.list; var html = ''; for(var i=0; i90){ desc=desc.substr(0,87)+"..."; } html += '
  • '; html += '
    '; html += '
    '; html += ''; if(typeof logo!="undefined"&&logo!=''){ html += ''; }else{ html += ''; } html += '
  • '; }else{ var date1=Number(list[i].focus_date) var time=new Date(date1) var y = time.getFullYear(); var m = time.getMonth()+1; var d = time.getDate(); var date= y+'-'+add0(m)+'-'+add0(d); if(i==2||i%4==0){ html += '
  • '; }else{ html += '
  • '; } html += '
    '; html += '
    '; html+=''+date+''; if(typeof logo!="undefined"&&logo!=''){ html += ''; }else{ html += ''; } html += '
  • '; } } $("#bottomHtml").html(html); appendPage(); } }); }); //移动切换数据 $("#wrapper03 .text a").click(function(){ $(this).parents('li').addClass("active").siblings().removeClass("active"); pageId = $(this).parent().parent().find('.img').find('a').eq(0).attr('pageId'); if(typeof pageId =="undefined" || pageId==''){ pageId = ''; var aList = $("#wrapper03 .img a"); for(var i=0 ; i0){ pageId = pageId.substring(0, pageId.length-1); } } $('.kuaikan18839_ind05 .more').html('') jiazaizhong = true curPage = 1; var url = '//api.cntv.cn/NewArticle/getArticleListByPageId?serviceId=pcnews&id=${pageId}&s=0&n='+pageSize; url = url.replace('${pageId}',pageId); $.ajax({ url: url, type: 'get', dataType: 'jsonp', jsonp:'cb', jsonpCallback: 'cb2', cache:true, success:function(data){ var list = data.data.list; var html = ''; for(var i=0; i'; html += '
    '; html += '
    '; html += ''; if(typeof logo!="undefined"&&logo!=''){ html += ''; }else{ html += ''; } html += '
    '; }else{ var date1=Number(list[i].focus_date) var time=new Date(date1) var y = time.getFullYear(); var m = time.getMonth()+1; var d = time.getDate(); var date= y+'-'+add0(m)+'-'+add0(d); if(i==2||i%4==0){ html += '
  • '; }else{ html += '
  • '; } html += '
    '; html += '
    '; html+=''+date+''; if(typeof logo!="undefined"&&logo!=''){ html += ''; }else{ html += ''; } html += '
  • '; } } $("#bottomHtml").html(html); appendPage(); } }); });
    '; html += '
    '; html += ''; if(typeof logo!="undefined"&&logo!=''){ html += ''; }else{ html += ''; } html += '
    '; }else{ var date1=Number(list[i].focus_date) var time=new Date(date1) var y = time.getFullYear(); var m = time.getMonth()+1; var d = time.getDate(); var date= y+'-'+add0(m)+'-'+add0(d); if(i==2||i%4==0){ html += '
  • '; }else{ html += '
  • '; } html += '
    '; html += '
    '; html+=''+date+''; if(typeof logo!="undefined"&&logo!=''){ html += ''; }else{ html += ''; } html += '
  • '; } } $("#bottomHtml").html(html); initPage(); } }); }) var iphone=/AppleWebKit.*mobile/i.test(navigator.userAgent) || /Android/i.test(navigator.userAgent)|| (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent)); function appendHtml(){ if(iphone){ var numpage=(curPage-1)*pageSize }else{ var numpage=((curPage-2)*pageSize)+9 } var url = '//api.cntv.cn/NewArticle/getArticleListByPageId?serviceId=pcnews&id=${pageId}&s='+numpage+'&n='+pageSize; url = url.replace('${pageId}',pageId); $.ajax({ url: url, type: 'get', dataType: 'jsonp', jsonp:'cb', jsonpCallback: 'cb2', cache:true, success:function(data){ var list = data.data.list; var html = ''; for(var i=0; i'; html += '
    '; html += '
    '; html += ''; if(typeof logo!="undefined"&&logo!=''){ html += ''; }else{ html += ''; } html += '
    '; }else{ var date1=Number(list[i].focus_date) var time=new Date(date1) var y = time.getFullYear(); var m = time.getMonth()+1; var d = time.getDate(); var date= y+'-'+add0(m)+'-'+add0(d); if(i==2||i%4==0){ html += '
  • '; }else{ html += '
  • '; } html += '
    '; html += '
    '; html+=''+date+''; if(typeof logo!="undefined"&&logo!=''){ html += ''; }else{ html += ''; } html += '
  • '; } } $("#bottomHtml").append(html); appendPage(); if(list.length==0||list.length<8){ $('.kuaikan18839_ind05 .more').text('没有更多内容了'); jiazaizhong = false; } } }); } function appendPage(){ changeLiPageStyle(); var iphone=/AppleWebKit.*mobile/i.test(navigator.userAgent) || /Android/i.test(navigator.userAgent)|| (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent)) if(iphone){ updateOr() }else{ var cWidth = document.documentElement.clientWidth; if(cWidth<1024){ $(".kuaikan18839_ind05 .con li").eq(0).removeClass("big").addClass("small"); }else{ $(".kuaikan18839_ind05 .con li.big").show(); $(".kuaikan18839_ind05 .con li").eq(0).addClass("big"); $(".kuaikan18839_ind05 .con li").show(); } //showLi(1); } } makeMobileYD(mobileYD1,'mobileYD1'); makeMobileYD(mobileYD2,'mobileYD2'); makeMobileYD(mobileYD3,'mobileYD3'); function initPage(){ appendPage(); } /*移动端 横竖屏判断*/ var wode = null; function updateOr(){ var init = function(){ var updateOrientation = function(){ var orientation = window.orientation; switch(orientation){ case 90: case -90: orientation = 'landscape'; //这里是横屏 wode=false; var cWidth = document.documentElement.clientWidth; if(cWidth>1024){ $("#topnav").show(); $(".up").show(); $(".nav_box_1000").show(); $(".kuaikan18839_ind05 .con li.big").show(); $(".kuaikan18839_ind05 .con li").eq(0).addClass("big").removeClass("small"); } else{ $(".kuaikan18839_ind05 .con li").eq(0).removeClass("big").addClass("small"); } //showLi(1); break; default: orientation = 'portrait'; //这里是竖屏 wode=true; $(".kuaikan18839_ind05 .con li").eq(0).removeClass("big").addClass("small"); //showLi(1); break; } document.body.parentNode.setAttribute('class',orientation); }; window.addEventListener('orientationchange',updateOrientation,false); updateOrientation(); }; window.addEventListener('DOMContentLoaded',init,false); } function showLi(curPage){ // 获得ul下所有的li /*var lis = $(".kuaikan18839_ind05 .con li").not(".big"); var beginLi; var endLi; // 根据curPage计算出beginLi和endLi 就是要显示的li从那一条开始,到哪一条结束 beginLi = (curPage-1)*pageSize;// 从0开始 endLi = beginLi + pageSize - 1; if (endLi >= lis.length-1){ endLi = lis.length; } for (var i = beginLi; i <= endLi; i++){ $(lis).eq(i).css("display","block"); }*/ appendHtml(); } var jiazaizhong = true; // 绑定:上拉加载更多监听 function addPullLoaderEvent() { if(window.addEventListener) { window.addEventListener('scroll', pullGetMore, false);//滚动条滚动执行addcomment方法 } else { window.attachEvent('onscroll', pullGetMore);//ie滚动条滚动执行addcomment方法 } } function pullGetMore(ev) { var sTop = document.body.scrollTop || document.documentElement.scrollTop; //距离body的距离 var dHeight = $(document).height(), //文档的高度 cHeight = document.documentElement.clientHeight; //可见内容区高度 var shangpanyi = $("#bottomHtml").offset().top; var modelHeight = $("#bottomHtml").height(); var ua = navigator.userAgent.toLowerCase(); if ((ua.indexOf('android') > -1)) { cHeight = cHeight + 40; //上面菜单高度 } var footerH=$(".footer").height(); if (sTop > shangpanyi + modelHeight - cHeight-50) { if(jiazaizhong){ curPage++; //if(curPage <= Math.ceil(liLen/pageSize)){ setTimeout(function(){ showLi(curPage); jiazaizhong = true; },800) jiazaizhong = false; //}else{ //$('.kuaikan18839_ind05 .more').text('没有更多内容了'); //} } } } pullGetMore(); addPullLoaderEvent(); window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function () { console.log(1) initPage() setTimeout(function(){ var deviceWidth = document.documentElement.clientWidth; if(deviceWidth>750){ document.documentElement.style.fontSize=750/7.5+"px"; }else{ document.documentElement.style.fontSize=deviceWidth/7.5+"px"; } },100) }) var chongfu =0; function changeLiPageStyle(){ $("#bottomHtml li").removeAttr('class'); var liList = $("#bottomHtml li"); for(var i=0; i