0

以下是我基于官方 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);
    });
4

0 回答 0