123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- import '../css/bootstrap.less';
- import 'bootstrap/dist/js/bootstrap.js';
- import 'css/newMenu/public.css';
- import 'css/newMenu/header.css';
- import '../css/main_banner.css';
- import './public.js';
- import './main_banner.js';
- import '../css/contactUs.css';
- (function(){
- $(".all_branch_map>div").hover(function(e){
- var hoverName=e.target.className+"div";
- $(".all_map_case>div").css("display","none");
- $(".all_map_case>div."+hoverName).css("display","block");
- })
- //创建和初始化地图函数:
- function initMap(){
- createMap();//创建地图
- setMapEvent();//设置地图事件
- addMapControl();//向地图添加控件
- addMarker();//向地图中添加marker
- }
-
- //创建地图函数:
- function createMap(){
- var map = new BMap.Map("dituContent");//在百度地图容器中创建一个地图
- var point = new BMap.Point(112.994937,28.21038);//定义一个中心点坐标
- map.centerAndZoom(point,17);//设定地图的中心点和坐标并将地图显示在地图容器中
- window.map = map;//将map变量存储在全局
- }
-
- //地图事件设置函数:
- function setMapEvent(){
- map.enableDragging();//启用地图拖拽事件,默认启用(可不写)
- map.enableScrollWheelZoom();//启用地图滚轮放大缩小
- map.enableDoubleClickZoom();//启用鼠标双击放大,默认启用(可不写)
- map.enableKeyboard();//启用键盘上下左右键移动地图
- }
-
- //地图控件添加函数:
- function addMapControl(){
- //向地图中添加比例尺控件
- var ctrl_sca = new BMap.ScaleControl({anchor:BMAP_ANCHOR_BOTTOM_LEFT});
- map.addControl(ctrl_sca);
- }
-
- //标注点数组
- var markerArr = [{title:"湖南科德信息咨询有限公司",content:"金山大厦八楼",point:"112.994892|28.210587",isOpen:0,icon:{w:20,h:30,l:0,t:-5,x:0,lb:12}}
- ];
- //创建marker
- function addMarker(){
- for(var i=0;i<markerArr.length;i++){
- var json = markerArr[i];
- var p0 = json.point.split("|")[0];
- var p1 = json.point.split("|")[1];
- var point = new BMap.Point(p0,p1);
- var iconImg = createIcon(json.icon);
- var marker = new BMap.Marker(point,{icon:iconImg});
- var iw = createInfoWindow(i);
- var label = new BMap.Label(json.title,{"offset":new BMap.Size(json.icon.lb-json.icon.x+10,-20)});
- marker.setLabel(label);
- map.addOverlay(marker);
- label.setStyle({
- borderColor:"#808080",
- color:"#333",
- cursor:"pointer"
- });
-
- (function(){
- var index = i;
- var _iw = createInfoWindow(i);
- var _marker = marker;
- _marker.addEventListener("click",function(){
- this.openInfoWindow(_iw);
- });
- _iw.addEventListener("open",function(){
- _marker.getLabel().hide();
- })
- _iw.addEventListener("close",function(){
- _marker.getLabel().show();
- })
- label.addEventListener("click",function(){
- _marker.openInfoWindow(_iw);
- })
- if(!!json.isOpen){
- label.hide();
- _marker.openInfoWindow(_iw);
- }
- })()
- }
- }
- //创建InfoWindow
- function createInfoWindow(i){
- var json = markerArr[i];
- var iw = new BMap.InfoWindow("<b class='iw_poi_title' title='" + json.title + "'>" + json.title + "</b><div class='iw_poi_content'>"+json.content+"</div>");
- return iw;
- }
- //创建一个Icon
- function createIcon(json){
- var icon = new BMap.Icon("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA1RpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1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6kETjdD5bm0/4lGsjU7SQu/eNf+PUurX45a6xeTiT0UlJBiFFyMSU8BROSUvdiwZ0F1BiiTbok5q4cE/x0d9qUtZK62EhU0/DpYwdK5/f+cxLf1v5zeym2VKlkkxkB7TITeMTLKb3kGKN3Axckp6eKZimtGOnx7J3XU5GU8AixVtaGJmCL4w9farZ/2B2sfXWD1RV5oVslVz3IfEEkCxMEo2AfBLEDFso8wMvH2o88VJOLRMV/scFNh66Q5cEHkznj5xsmpf3bhjtx5jKoUmCXJbBoqTIRhAUr7bYAo9yqwdLj5/MSJl+TJHK6Uoat/wtpJ2ywQ5M1LSphaONb5+Mken0rBbcaIsUpYwg8gNS1kWf1HY37y1+82cPTjz7fkJZUvJG5ELa5UHQHdbuOGGSo6pNYlTf8wcqlnsvdl49LmXapbxaR1I8BMFZoWHtlB54Ybpw+LVE5cTqOxtXRJ7irpC6hbS8+2TVAI3cvlOj2szLpmVhQC4mIWOLHkZx6O3PVb92UpG0MI63DaHCgu3OVpaup+edzw3w/GA4QMB9SreBb0yeuf7rV7rSpaOlkQokd+ydrzd+/tyB+v2LDmVTUmATCVyLOGRDDuWYbZvskUsBnX6yAjbi0GmXw66itsrZT59/vfmL1+gMZUeL3//RaG5y0aa89n1Su08BTiLFlFGqqn5yjA7PP9IqSDxgcDsyHDmAk7NQ0RqX7qt/5ye2Y2h5tXbB6dN3zya1Y6rSdPTSnUts6NinAIcnfdoT60Mqog4FRKzK2Fv44hnBKUv6jHjkkGR/aNH2/P876D+FyYYkM04VXKaCG+ggLZIghEaRSpFOucxvz/vfJn+Cw3hEFdZxnKd8338gCAIehmHyjQ//OcQJUJSASJIUK4oiaPwf9P47epfT3KBpHwPGSUsm06KPaMK/6ZUnuySAcRzftoDGIpoTJ3dZlps0niyOsJ1y/xVgAPlxkvf6vvCyAAAAAElFTkSuQmCC", new BMap.Size(json.w,json.h),{imageOffset: new BMap.Size(-json.l,-json.t),infoWindowOffset:new BMap.Size(json.lb+5,1),offset:new BMap.Size(json.x,json.h)})
- return icon;
- }
-
- initMap();//创建和初始化地图
- })();
|