2013-03-03 52 views
0

我無法關閉google maps Api中的infoWindow。任何人都可以幫助我。我有5個標記,每個標記都包含一個svg文件。我還想調整信息窗口的高度,我dono如何做到這一點?can's關閉InfoWindow

var infowindow = new google.maps.InfoWindow({ 
content: '<IMG BORDER="0" ALIGN="Left" SRC="test.svg">', 
maxWidth: 300, 
}); 

var infowindow1 = new google.maps.InfoWindow({ 
content: '<IMG BORDER="0" ALIGN="Left" SRC="test.svg">', 
maxWidth: 300, 
}); 

var infowindow2 = new google.maps.InfoWindow({ 
content: '<IMG BORDER="0" ALIGN="Left" SRC="test.svg">', 
maxWidth: 300, 
}); 

var infowindow3 = new google.maps.InfoWindow({ 
content: '<IMG BORDER="0" ALIGN="Left" SRC="test.svg">', 
maxWidth: 300, 
}); 

var infowindow4 = new google.maps.InfoWindow({ 
content: '<IMG BORDER="0" ALIGN="Left" SRC="test.svg">', 
maxWidth: 300, 
}); 

var infowindow5 = new google.maps.InfoWindow({ 
content: '<IMG BORDER="0" ALIGN="Left" SRC="test.svg">', 
maxWidth: 300, 
}); 

// event handlers for clicking 
google.maps.event.addListener(marker, 'click', function(){ 
    infowindow.open(googleMap,marker); 
    infowindow.close(); 
}); 

google.maps.event.addListener(marker1, 'click', function(){ 
    infowindow1.open(googleMap,marker1); 
    infowindow1.close(); 
}); 

google.maps.event.addListener(marker2, 'click', function(){ 
    infowindow2.open(googleMap,marker2); 
    infowindow2.close();   
}); 

google.maps.event.addListener(marker3, 'click', function(){ 
    infowindow3.open(googleMap,marker3); 
    infowindow3.close();  
}); 

google.maps.event.addListener(marker4, 'click', function(){ 
    infowindow4.open(googleMap,marker4); 
    infowindow4.close();   
}); 

google.maps.event.addListener(marker5, 'click', function(){ 
    infowindow5.open(googleMap,marker5); 
    infowindow5.close(); 
}); 

}

+0

逗留一看,只有1個例。不需要發佈全部5個聽衆(因爲他們都有相同的表格) – 2013-03-03 06:35:18

回答

1

用這個例子:

var bizInfowindow = new google.maps.InfoWindow(); 
var html = "somecontent html form"; 
bizInfowindow.close(); 
bizInfowindow.close(); 
bizInfowindow.setContent(html); 
bizInfowindow.open(map, marker); 

採取雙重接近

+0

這完全不能幫助我 – 2013-03-03 06:57:12

相關問題