Here below is my code to add an infobubble. I want to remove the current infobubble previously after click(tap) on a different marker.
function addInfoBubble
Here's a more in-depth summary of things you can do:
Remove the last infobubble that was created:
ui.removeBubble(bubbles[bubbles.length - 1])
Close the first infobubble that was created:
bubbles[bubbles.length - 1].close()
Remove the first infobubble that was created:
ui.removeBubble(bubbles[0])
Close all the bubbles:
bubbles.forEach((bubble) => {
bubble.close()
});
Remove all the bubbles
while(bubbles.length > 0) {
this.ui.removeBubble(bubbles[0])
}
Click on the infobubbles Demo so you can try these out.