2012-07-22 44 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