无法使用谷歌地图关闭infowindow

时间:2013-03-06 03:43:06

标签: google-maps infowindow

var markers = {};
var openedInfoWindow = null;    

function addDoctorLocation(options) 
{
    var gm = Ext.getCmp('mygooglemap');
    var mpoint = new google.maps.LatLng(options.lat,options.lng);
    var marker = gm.addMarker(mpoint,options.marker,false,false, options.listeners);
    markers[options.MainID] = marker;

    infowindow = new google.maps.InfoWindow({
    content: "Hello from this marker"
  });
    google.maps.event.addListener(marker, 'click', function() {
      if (openedInfoWindow != null) openedInfoWindow.close();  // <-- changed this
      infowindow.open(map, marker); 
      // added next 4 lines
      openedInfoWindow = infowindow;
      google.maps.event.addListener(infowindow, 'closeclick', function() {
          openedInfoWindow = null;
      });
    });
}

点击infowindow关闭按钮时,没有任何反应 单击标记时此代码将出现此错误,但信息窗口正确显示在gmappanel

TypeError: b.O is not a function
[Break On This Error]   

(82 out of range 43)

1 个答案:

答案 0 :(得分:0)

请阅读Info Window