百度地图 infoBox的用法


var myIcon = new BMap.Icon("image/red.gif", new BMap.Size(23, 25), { offset: new BMap.Size(0, 0)});
var marker = new BMap.Marker(point,{icon:myIcon});
map.addOverlay(marker);
var label = new BMap.Label("公司名称:"+di.name,{offset:new BMap.Size(5,-40)});
label.setStyle({
paddingLeft:"12px",  //给label设置样式,任意的CSS都是可以的
fontSize:"12px", //字号
border:"0", //边
height:"50px", //高度
"280px", //宽
textAlign:"top", //文字水平居中显示
lineHeight:"30px", //行高,文字垂直居中显示
background:"url(image/showbox.png) no-repeat", //背景图片
cursor:"pointer"
});
marker.setLabel(label);

原文地址:https://www.cnblogs.com/IT-shen/p/4193475.html