2012-07-22 155 views
0

如何把标记放在带有透明文本标签的Google地图上?谷歌地图标记与透明文字标签

例如: 带有天气覆盖图的Google地图具有透明背景的温度。
标记的标签动态更改。 Ex当温度改变时标签也改变。

Google map with weather option selected

+0

你确定它的文本,而不是一个形象呢?此外,http://whathaveyoutried.com – gorelative 2012-07-22 19:43:41

+0

@gorelative不是100%肯定,但它可能是透明的图像。75F在一个地方的背景与背景相匹配。如果你看到的地名与背景相匹配。我想为我的标记提供一个透明的标签,这些标签经常会像温度一样变化。 – 2sb 2012-07-22 19:54:04

回答

3

尝试MarkerWithLabel实用程序库。这里的a demo

最低要求是CSS样式。

.labels { 
    color: red; 
    background-color: transparent; 
    font-family: "Lucida Grande", "Arial", sans-serif; 
    font-size: 10px; 
    font-weight: bold; 
    text-align: center; 
    width: 100px; 
    border: 0; 
} 

var marker1 = new MarkerWithLabel({ 
    position: new google.maps.LatLng(0,-5), 
    draggable: true, 
    raiseOnDrag: true, 
    map: map, 
    labelContent: "Tina's transparent Marker With Label", 
    labelAnchor: new google.maps.Point(50, 0), 
    labelClass: "labels", // the CSS class for the label 
    labelStyle: {opacity: 0.75} 
    }); 
+0

喜欢它。感谢q。 – 2sb 2012-07-22 20:34:37

+0

链接过时。 – Moustachio 2017-09-11 01:16:29