var map,marker,infoWin; var companyName = decodeURIComponent("陕西金地美容美发培训学院"); var phoneNum = decodeURIComponent("400-101-2260"); var remarks = decodeURIComponent("和平门校区"); var navLink = "http://map.baidu.cn/mobile/#place/linesearch/foo=bar/from=plac&start=point%3D12697665.201524%2C2564409.7260459e&end="; var endStr = "word="+companyName+"&point=113.931993,22.521852&uid=1acac6ad384ab3250ecbfb8982aad076";// 524424ea58ee9582601c672b navLink += encodeURIComponent(endStr)+"&tab=line"; var html = []; html.push('

学院信息

'); html.push(''); html.push(' '); html.push(' '); html.push(' '); html.push(' '); html.push(' '); html.push(' '); html.push(' '); html.push(' '); html.push(' '); html.push(' '); html.push(' '); html.push(' '); html.push('
名称:'+companyName+'
电话:'+phoneNum+'
地址:'+remarks+'
'); html.push("
"); html.push("电话"); /*html.push("导航");*/ html.push("导航"); html.push("
"); if(window.pageYOffset == 0){ window.scrollTo(0, window.pageYOffset + 1); } var container = $("#container"); container.height($(window).height()+60); container.attr("companyName",companyName); container.attr("phoneNum",phoneNum); container.attr("remarks",remarks); map = new BMap.Map("container"); var pointer = new BMap.Point(108.97118,34.253163); var pointer = new BMap.Point(108.97118,34.253163); container.attr("lng",108.97118); container.attr("lat",34.253163); map.addControl(new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_LEFT})); map.addControl(new BMap.MapTypeControl({mapTypes: [BMAP_NORMAL_MAP,BMAP_HYBRID_MAP]})); infoWin = new BMap.InfoWindow(html.join("")); marker = new BMap.Marker(pointer); // 创建标注 //marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画 map.addOverlay(marker); // 将标注添加到地图中 marker.openInfoWindow(infoWin);// 打开信息窗口 marker.addEventListener("click",function(){ this.openInfoWindow(infoWin); }); map.centerAndZoom(pointer, 15); map.panBy(-200,80); /**** 导航 ****/ function daohang(){ var geolocation = new BMap.Geolocation(); geolocation.getCurrentPosition(function(r){ if(this.getStatus() == BMAP_STATUS_SUCCESS){ var driving = new BMap.DrivingRoute(map, {renderOptions:{map: map, autoViewport: true}}); driving.search(r.point,pointer); }else { appUtil.alert("定位失败!") } },{enableHighAccuracy: true}); }