V_H24
V_H24

Reputation: 139

can's close the InfoWindow

I can't close the infoWindow in google maps Api. anybody can help me with it. I have 5 markers each contain a svg file in there. I would like also resize the hight of the info windo which i dono how to do it?

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();
});   

}

Upvotes: 0

Views: 88

Answers (1)

Maxim Shoustin
Maxim Shoustin

Reputation: 77930

Use this example:

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

Take a look on double close

Upvotes: 1

Related Questions