百度地图API,在地图上添加了一个标注,怎么才能让这个标注随着地图缩放而缩放呢?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了百度地图API,在地图上添加了一个标注,怎么才能让这个标注随着地图缩放而缩放呢?相关的知识,希望对你有一定的参考价值。
把下面的代码加到您最后面的javascript里var navigationControl = new BMap.NavigationControl(
// 靠左上角位置
anchor: BMAP_ANCHOR_TOP_LEFT,
// LARGE类型
type: BMAP_NAVIGATION_CONTROL_LARGE,
// 启用显示定位
enableGeolocation: true
);
map.addControl(navigationControl);
// 添加定位控件
var geolocationControl = new BMap.GeolocationControl();
geolocationControl.addEventListener("locationSuccess", function(e)
// 定位成功事件
var address = \'\';
address += e.addressComponent.province;
address += e.addressComponent.city;
address += e.addressComponent.district;
address += e.addressComponent.street;
address += e.addressComponent.streetNumber;
alert("当前定位地址为:" + address);
);
geolocationControl.addEventListener("locationError",function(e)
// 定位失败事件
alert(e.message);
);
map.addControl(geolocationControl);
此代码时控制地图缩放的代码 参考技术A 一直就那么大的 不会缩放本回答被提问者采纳
以上是关于百度地图API,在地图上添加了一个标注,怎么才能让这个标注随着地图缩放而缩放呢?的主要内容,如果未能解决你的问题,请参考以下文章