以下是我对地图标记的代码,它基于the official api,出于某种原因,当我点击标记时,信息窗口不会打开。有任何想法吗?我做错了什么?
var marker = new google.maps.Marker({
position: latlng,
map: map,
title: "You are here! (at least within a " + position.coords.accuracy + " meter radius)"
});
var contentString = 'test';
var infoWindow = new google.maps.InfoWindow({
content: contentString
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map, marker);
});