Home >Web Front-end >JS Tutorial >How to remove marker overlay or markerlabel text on Baidu Maps

How to remove marker overlay or markerlabel text on Baidu Maps

小云云
小云云Original
2018-01-31 09:50:573606browse

This article mainly shares with you a method to remove the marker covering or the maker's label text on Baidu Map. It has a good reference value and I hope it will be helpful to everyone. Let’s follow the editor to take a look, I hope it can help everyone.

As shown below:

var marker = new BMap.Marker(...);
//方法1
map.removeOverlay(marker);
//方法2
marker.remove(); 
//如果是Marker设置的setLabel还可以设置其样式来隐藏 
mapComponent.state.bikeMarkLabel.setStyle({
  display:"none"
}); 41787

The method of label is the same as marker.

It is recommended to use methods 1 and 2. Method 3 only hides rather than clears

Related recommendations:

How to clear the specified overlay in Baidu map api Overlay

Baidu Map API-Add event method to custom overlay_PHP tutorial

##Baidu Map API-Add event method to custom overlay

The above is the detailed content of How to remove marker overlay or markerlabel text on Baidu Maps. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn