我有一个带有单个标记和单个 infoBubble 的谷歌地图。单击标记时会出现信息气泡。问题是信息气泡出现在标记上,而不是在它上面。见截图:
infoBubble 已关闭: infoBubble 已打开: 这是代码,我正在使用地理编码器,因为我只有指定的地址:
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var myOptions = {
zoom: 14,
center: results[0].geometry.location,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
//i am using simple InfoBubble initialization
var infoBubble = new InfoBubble(
{
map: map,
content: "<h2>"+name+"</h2><div>"+street+"</div><div>"+city+", "+zip+"</div>"
});
google.maps.event.addListener(marker, 'click', function(e) {
infoBubble.open(map,marker);
});
}
});
任何线索为什么会这样?