看代码
<!--地图开始-->
<script type="text/javascript" src="https://gz.bcebos.com/v1/gz-shengtai/CMS/20201109/map.js"></script>
<style type="text/css">
#allmap {
width: 100%;
height: 400px;
margin-top: 20px;
overflow: hidden;
font-family: "微软雅黑";
}
#allmap b {
color: #CC5522;
font-size: 14px;
}
#allmap img {
max-width: none;
}
</style>
<div id="allmap"></div>
<script type="text/javascript">
var map = new BMap.Map("allmap");
map.centerAndZoom(new BMap.Point({dede:global.cfg_zuobiao/}), 18);
var marker1 = new BMap.Marker(new BMap.Point(116.397128,39.916527)); // 这里填写你的地址坐标,如果不知道的话进入(https://jingweidu.bmcx.com/)网站查询,填写标准:经度,纬度
map.addOverlay(marker1); // 将标注添加到地图中
//marker1.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
//创建信息窗口
var infoWindow1 = new BMap.InfoWindow(
"<b>公司名称:你的公司名称</b><br>地址:公司地址"
);
marker1.openInfoWindow(infoWindow1);
//marker1.addEventListener("click", function(){this.openInfoWindow(infoWindow1);});
//向地图中添加缩放控件
var ctrl_nav = new BMap.NavigationControl({
anchor: BMAP_ANCHOR_TOP_LEFT,
type: BMAP_NAVIGATION_CONTROL_LARGE
});
map.addControl(ctrl_nav);
//向地图中添加缩略图控件
var ctrl_ove = new BMap.OverviewMapControl({
anchor: BMAP_ANCHOR_BOTTOM_RIGHT,
isOpen: 1
});
map.addControl(ctrl_ove);
//向地图中添加比例尺控件
var ctrl_sca = new BMap.ScaleControl({
anchor: BMAP_ANCHOR_BOTTOM_LEFT
});
map.addControl(ctrl_sca);
map.enableDragging(); //启用地图拖拽事件,默认启用(可不写)
map.enableScrollWheelZoom(); //启用地图滚轮放大缩小
map.enableDoubleClickZoom(); //启用鼠标双击放大,默认启用(可不写)
map.enableKeyboard(); //启用键盘上下左右键移动地
</script>
<!--地图结束-->