How to remove previous infobubble, if I click different marker in HERE Map?

后端 未结 2 1068
小蘑菇
小蘑菇 2021-01-18 03:15

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         


        
2条回答
  •  醉梦人生
    2021-01-18 03:40

    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.

提交回复
热议问题