我在谷歌地图上的标记有问题,它没有出现在地图的中心,而是总是出现在地图的左上角。
这是我的代码。感谢您的回复!
函数初始化(){getCurrentLocation();
google.maps.visualRefresh = true;
currentLocationGPS = new google.maps.LatLng(latPos,longPos);
var myOptions = {
zoom: 8,
center: currentLocationGPS,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var marker = new google.maps.Marker({
position: currentLocationGPS,
map: map,
draggable:true
});
google.maps.event.addListener(
marker,
'drag',
function() {
latPos = marker.position.lat();
latLong = marker.position.lng();
}
);
}