$(function(){ $(".arrow").click(function(){ var _this=$(this); var _id=$(this).data("toggle").slice(8,$(this).data("toggle").length) var _class=$(this).attr("class") $(".origin_list_con").each(function(){ if(_id==$(this).data("id")){ if(_class.indexOf("active")>0){ $(this).css("display","none") }else{ $(this).css("display","block") } }else{ // $(this).hide(); } }) }) // PC端 入口鼠标滑过特效 $(".enter_item").hover(function(){ $(this).addClass("active") },function(){ $(this).removeClass("active") }) $(".linkPoint_tit").click(function(){ // var _len=$(this).siblings(".linkPoint_content").find(".linkPoint_content_ul").children().length; // console.log($(".source").height()) // $(".source").css("height",45*_len+150+"px") if($(this).attr("class").indexOf("active")>0){ $(this).removeClass("active"); $(this).siblings().hide() }else{ $(this).addClass("active"); $(this).siblings().show() } }) $(".linkPoint_content ul li").click(function(){ var id=$(this).data("id"); $(this).parent(".linkPoint_content_ul").siblings(".modal").each(function(){ var _id=$(this).data("item"); if(id==_id){ $(this).show(); $(".mask").show(); } }) }) $(".close").click(function(){ $(".mask").hide(); $(this).parents(".modal").hide(); }) $("#tabTit li").click(function(){ if($(this).attr("class").indexOf("active")<0){ $(this).addClass("active") $(this).siblings().removeClass("active") } var id=$(this).data("id"); $(this).parents(".modal_tab_tit").siblings(".modal_tab_item").each(function(){ var _id=$(this).data("item"); if(id==_id){ $(this).show(); $(this).siblings(".modal_tab_item").hide(); } }) }) //搜索入口 $(".searchBtn").click(function(){ var _val=$("#searchIpt").val(); console.log(_val) if(_val!="" && _val!=null && _val!=undefined){ if(_val.indexOf("400257")>=0){ window.location.href="pcNjsy.html" }else if(_val.indexOf("080135")>=0){ window.location.href="pcSsnr.html" }else if(_val.indexOf("925003")>=0){ window.location.href="pcYlsy.html" }else if(_val.indexOf("001604")>=0){ window.location.href="pcLxnr.html" }else if(_val.indexOf("005013")>=0){ window.location.href="pcGxsy.html" }else{ alert("您输入的溯源码不存在,请检查!") } }else{ alert("请输入溯源码!") } }) $(document).keyup(function(event){ if(event.keyCode==13){ $(".searchBtn").trigger("click") } }) $(".menuDown").click(function(){ if($(this).attr("class").indexOf("active")>0){ $(this).removeClass("active") $(".menuDown_list").hide() }else{ $(this).addClass("active") $(".menuDown_list").show() } }) }) var myIcon=new BMap.Icon("images/car.png",new BMap.Size(40,32),{ imageOffset: new BMap.Size(0,0) }) function run(P1,P2,T1,T2){ var driving = new BMap.DrivingRoute(map, {renderOptions: {map: map, autoViewport: true,enableRotation:true}}); //驾车实例 driving.search(P1, P2); driving.setSearchCompleteCallback(function(res){ var pts = driving.getResults().getPlan(0).getRoute(0).getPath(); //通过驾车实例,获得一系列点的数组 map.addOverlay(new BMap.Polyline(pts, { strokeColor: '#000', strokeWeight:1 })); var paths = pts.length; //获得有几个点 var carMk = new BMap.Marker(pts[0],{icon:myIcon}); map.addOverlay(carMk); var startLabel=new BMap.Label(T1,{ offset:new BMap.Size(30,25) }) var endLabel=new BMap.Label(T2,{ offset:new BMap.Size(30,25) }) startLabel.setStyle({ "background":"rgb(65, 189, 247)", "color":"white", "font-size":"12px", "border":"none", "cursor":"pointer", "padding":"5px 10px", "border-radius":"8px", "box-shadow":"2px 2px 6px #d7cccc" }) endLabel.setStyle({ "background":"rgb(65, 189, 247)", "color":"white", "font-size":"12px", "border":"none", "cursor":"pointer", "padding":"5px 10px", "border-radius":"8px", "box-shadow":"2px 2px 6px #d7cccc" }) var startMk=new BMap.Marker(pts[0]); var endMk=new BMap.Marker(pts[paths-1]); startMk.setLabel(startLabel);//添加label endMk.setLabel(endLabel);//添加label map.addOverlay(startMk); map.addOverlay(endMk); i=0; function resetMkPoint(i){ carMk.setPosition(pts[i]); if(i < paths){ setTimeout(function(){ i++; resetMkPoint(i); },0.0000000001); } } setTimeout(function(){ resetMkPoint(20); },10) }); } 'asdas'.toLocaleUpperCase()