我用这段代码制作地图
var map;
var myOptions = {
center: new google.maps.LatLng(-31.403759,-64.174232),
zoom: 12,
panControl: true,
zoomControl: true,
mapTypeControl: true,
scaleControl: true,
streetViewControl: true,
overviewMapControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
function iniciar() {
map = new google.maps.Map(document.getElementById("map"),myOptions);
}
function marcar(lat, lng) {
var contentString = '<div id="content">'+
'<div id="siteNotice">'+
'</div>'+
'<h1 id="firstHeading" class="firstHeading">Uluru</h1>'+
'<div id="bodyContent">'+
'<p><b>Uluru</b>, also referred to as <b>Ayers Rock</b>, is a large ' +
'sandstone rock formation in the southern part of the '+
'Northern Territory, central Australia. It lies 335 km (208 mi) '+
'south west of the nearest large town, Alice Springs; 450 km '+
'(280 mi) by road. Kata Tjuta and Uluru are the two major '+
'features of the Uluru - Kata Tjuta National Park. Uluru is '+
'sacred to the Pitjantjatjara and Yankunytjatjara, the '+
'Aboriginal people of the area. It has many springs, waterholes, '+
'rock caves and ancient paintings. Uluru is listed as a World '+
'Heritage Site.</p>'+
'<p>Attribution: Uluru, <a href="http://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
'http://en.wikipedia.org/w/index.php?title=Uluru</a> (last visited June 22, 2009).</p>'+
'</div>'+
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var location=new google.maps.LatLng(lat,lng);
var marker = new google.maps.Marker({
position: location,
map: maps
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
当我尝试单击标记时,它们会被取消校准,因此当我单击标记的中心时不会发生任何事情。但是向下几厘米时,会出现一个光标,就像标记在那个点上一样。
所以地图没有居中,标记出现在真实坐标处,但我必须单击距离标记向下 2 厘米才能单击标记...
这是为什么??有没有其他人发生过这种情况??