以下为百度地图相关效果图:
注:该例子主要思路是将覆盖物(marker)通过css定位上去的,但是存在一个问题,当浏览器窗口宽度改变时,覆盖物会自动定位到地图中心位置,但是地图可能不会。
maphtml{height:100%}
body{height:100%;margin:0px;padding:0px}
#container{height:100%}
.mapicon{
position: fixed;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-100%);
width: 52px;
/* margin-top: -200px; */
}
/**
* 主要通过地图的地理位置与像素转换实现效果
*/
var map = new BMap.Map("container");
var point = new BMap.Point(116.404, 39.915);
/**
* Y轴偏移量,即地图可视区域中心点在Y轴的偏移量
* 当你的地图底部还有一些输入框的时候,可