Say you have a map with one InfoBubble as your overlay for markers and other things. I didn't want to initialize one InfoBubble for each marker and position on the map, because I only want to display one InfoBubble at a time.
So I initialize a new InfoBubble:
var infoBubble = new InfoBubble({
borderRadius: 0,
width: 350,
height: 200
}),
Somewhere else in the code I take care about opening and exchanging the content:
infoBubble.setContent('<p>foo</p>');
if (marker) { // When I have a marker I want to place the bubble above the marker
infoBubble.setAnchor(item.marker);
infoBubble.setArrowSize(15);
} else { // otherwise just reposition the InfoBubble
infoBubble.setPosition(item.position);
infoBubble.setArrowSize(0); // I don't want have an arrow if the item has no corresponding marker
}
if (!infoBubble.isOpen()) { // unless the InfoBubble is open, we open it
infoBubble.open(map);
}
Please consider integrating this.