$(function() { //地图 setInterval("autochange()",10000); //背景 var wid = $(document).width(); var hei = $(document).height(); $("#particles-js").height(hei); $("#particles-js").width(wid); //时间 间隔一秒执行一次获取当前时间的方法 setInterval(function () { CurrentTime() }, 1000); // 接口占比 jkzb(); // 归集数据/接口排名 jkgj(); jkgj2(); // 切换 var i=0;//初始记录用户鼠标经过是第几个li var canmove=true; $('.tab_tit span').mouseenter(function(i){ canmove=false; clearInterval(li_timer); i=$(this).index(); $(this).addClass('on').siblings().removeClass('on'); $(this).attr('v',i); var e = $('.tab_div1 .jkgj_tab').index(); $('.tab_div1 .jkgj_tab').attr('v',i); $('.tab_div1 .jkgj_tab').hide(); $('.tab_div1 .jkgj_tab').eq(i).show(); if($('.tab_div1 .jkgj_tab').eq(1).is(':hidden')){ // myChart22.resize(); // myChart33.removeAttribute("_echarts_instance_"); // myChart22.setOption(option,true); jkgj(); }else if($('.tab_div1 .jkgj_tab').eq(0).is(':hidden')){ // myChart33.resize(); // myChart22.removeAttribute("_echarts_instance_"); // myChart33.setOption(option,true); jkgj2(); } }); $(".tab_div1").mouseenter(function(){//只要用户鼠标在这个tab1区域内,就不自动跳转 canmove=false; }).mouseleave(function(){ clearInterval(li_timer); setTimeout(function(){canmove=true;},2000);//两秒后自动切换 }); function li_timer(){ // wid = 100; if(canmove){ i++; if(i==$('.tab_tit span').length){ i=0; } $('.tab_tit span').eq(i).addClass('on').siblings().removeClass('on'); $('.tab_div1 .jkgj_tab').hide(); $('.tab_div1 .jkgj_tab').eq(i).show(); } } setInterval(li_timer,5000);//每两秒切换 // 省、市接口调用切换 sjk1(); sjk2(); shjk1(); shjk2(); // 切换 var u=0;//初始记录用户鼠标经过是第几个li var canmoveu=true; $('.tab_tit2 span').mouseenter(function(i){ canmoveu=false; clearInterval(li_timer2); u=$(this).index(); $(this).addClass('on').siblings().removeClass('on'); $('.tab_div2').hide(); $('.tab_div2').eq(u).show(); if($('.tab_div2').eq(1).is(':hidden')){ shjk1(); shjk2(); }else if($('.tab_div2').eq(1).is(':hidden')){ sjk1(); sjk2(); } }); $(".tab_div2").mouseenter(function(){//只要用户鼠标在这个tab1区域内,就不自动跳转 canmove=false; }).mouseleave(function(){ clearInterval(li_timer2); setTimeout(function(){canmoveu=true;},2000);//两秒后自动切换 }); function li_timer2(){ // wid = 100; if(canmoveu){ u++; if(u==$('.tab_tit2 span').length){ u=0; } $('.tab_tit2 span').eq(u).addClass('on').siblings().removeClass('on'); $('.tab_div2').hide(); $('.tab_div2').eq(u).show(); } } setInterval(li_timer2,5000);//每两秒切换 // 归集数据分析 gjsj(); // 弹框数据归集 // tk_gjsj(); }); // 时间 //时间 function getNow(Mytime) { return Mytime < 10 ? '0' + Mytime : Mytime; } function CurrentTime() { var myDate = new Date(); //获取当前年份 var year = myDate.getFullYear(); //获取当前月份 var month = myDate.getMonth() + 1; //获取当前日期 var date = myDate.getDate(); //获取当前小时数(0-23) var h = myDate.getHours(); //获取当前分钟数(0-59) var m = myDate.getMinutes(); var s = myDate.getSeconds(); var now = year + '-' + getNow(month)+ '-' + getNow(date); var now2 = getNow(h)+ ':' + getNow(m) + ':' + getNow(s); $(".nyr").text(now); $(".sfm").text(now2); } //地图 var obj = [ function() { $(".map_img").removeClass("movefd"); $(".map_img").addClass("movesx"); },function() { $(".map_img").removeClass("movesx"); $(".map_img").addClass("movess"); }, function() { $(".map_img").removeClass("movess"); $(".map_img").addClass("movexj"); }, function() { $(".map_img").removeClass("movexj"); $(".map_img").addClass("movefd"); } ] $.each(obj, function(i) { // Replace 500 with whatever you want setInterval(this, 10000 * i); }); function mp_id1() { $('.map_id1').addClass("mp_hide").removeClass("mp_show"); $('.map_id2').addClass("mp_show").removeClass("mp_hide"); } function mp_id2() { $('.map_id2').addClass("mp_hide").removeClass("mp_show"); $('.map_id3').addClass("mp_show").removeClass("mp_hide"); } function mp_id3() { $('.map_id3').addClass("mp_hide").removeClass("mp_show"); $('.map_id4').addClass("mp_show").removeClass("mp_hide"); } function mp_id4() { $('.map_id4').addClass("mp_hide").removeClass("mp_show"); $('.map_id1').addClass("mp_show").removeClass("mp_hide"); } // 设置一个判断计数器 var count=0; // 根据计数器状态切换响应的皮肤 function autochange() { if (count==0) { mp_id1(); } if (count==1) { mp_id2(); } if (count==2) { mp_id3(); } if (count==3) { mp_id4(); } count=count+1; if (count>3) { count=0; } }