Show only one infobubble "at a time" in google maps API 3.1
I am trying to make it so that only one infobubble shows at a time, in
other words to toggle infobubble. The marker gets assigned this event
handler in a for loop, looping through the marker array.
at the moment this works in a way that opens the infobubble but never
closes it. I can click multiple markers and each will have the infobubble
with out closing the previous one
Iv tried adding infobuble2.close(); but the closes iv got with it is i
would have to click on the markers twice to close the previous
infobubbles.
And yes you are wondering i have tried infowindow, and the functionality
works well using it. but because of design constrains i need to style the
popup accordingly below is my code
var infoBubble2;
google.maps.event.addListener(marker, 'click', function() {
infoBubble2 = new InfoBubble({
map: map,
position: new google.maps.LatLng(-35, 151),
shadowStyle: 1,
padding: 0,
backgroundColor: 'rgb(255,255,255)',
borderRadius: 4,
arrowSize: 10,
borderWidth: 1,
borderColor: '#2c2c2c',
disableAutoPan: true,
hideCloseButton: !0,
arrowPosition: 30,
backgroundClassName: 'phoney',
arrowStyle: 2
});
infoBubble2.setContent("some content");
infoBubble2.open(map, marker);
});
No comments:
Post a Comment