var resulttexttype={ 'forecast':"结果预测", 'trend':"结果走势", 'census':"间隔数据", 'result':"历史结果", } $(document).ready(function(){ showpage(); $(".result-nav a").click(function(e){ var tab = e.target.dataset.tab; $(".result-active").removeclass('result-active'); $(e.target).addclass('result-active'); $('.fixed_modle').css({display: 'flex'}); $('.f_m_title_text').html(resulttexttype[tab]); if(tab == 'forecast'){ $('.forecast-nav').show(); getforecastdata('zh'); } $("#" + tab).show(); }); $(".forecast-nav span").click(function(e){ $(".forecast-nav span").removeclass("active"); e.target.classlist = ['active']; var types = e.target.dataset.type; getforecastdata(types); }); }); function getforecastdata(type){ $(".forecast-type").hide(); $(".forecast-type." + type).show(); } var timeout; function showpage(){ timeout = setinterval(function () { times = times - 1; settime(times); }, 1000) } function settime(time){ var hour = parseint(time/60/60); var min = parseint(time/60%60); var sec = parseint(time%60); if(hour < 10){ hour = "0" + hour; } if(min < 10){ min = "0" + min; } if(sec < 10){ sec = "0" + sec; } if(time >= 0){ var timehtml = "还有 "+ min +""+ sec +""; if(hour > 0){ timehtml = "还有 "+ hour +""+ min +""+ sec +""; } $("#times").html(timehtml); if(hour > 0){ $("#mi-time").html(hour+"时"+min + "分" + sec); }else{ $("#mi-time").html(min + "分" + sec); } } else { getdata(); $("#times").html("开奖中..."); $(".center-lo").show(); $("#mi-time").html('--' + "分" + '--'); } } function getdata(){ settimeout(() => { window.location.reload(); },5000); } function hidenfixedmodle(){ $('.fixed_modle').hide(); $('.forecast-nav').hide(); $('.result_fixed').hide(); }