实现效果如下:(不同的地区,显示的地址信息不同)
引入的Js:
Js代码:
AMapUI.load([‘ui/geo/DistrictExplorer’, ‘lib/$’], function(DistrictExplorer, $) {
//创建一个实例
var districtExplorer = new DistrictExplorer({
map: map
});
var $tipMarkerContent = $('<div class="tipMarker top"></div>');
var tipMarker = new AMap.Marker({
content: $tipMarkerContent.get(0),
offset: new AMap.Pixel(0, -25),
bubble: true
});
function listenMouseEvents() {
var isLocating = false;
map.on('mousemove', function(e) {
if (isLocating) {
return;
}
isLocating = true;
districtExplorer.locatePosition(e.lnglat, function(err, features) {
i