0
我正在尋找一種解決方案來更改API V3中Google地圖中製作者的顏色。我想更改鼠標懸停時製造商的顏色。如果有人得到解決方案,請發佈他們,我會非常感激。在此先感謝如何更改谷歌地圖API中標記的顏色3
我正在尋找一種解決方案來更改API V3中Google地圖中製作者的顏色。我想更改鼠標懸停時製造商的顏色。如果有人得到解決方案,請發佈他們,我會非常感激。在此先感謝如何更改谷歌地圖API中標記的顏色3
您必須自定義標記屬性併爲此使用自定義標記和陰影圖像。但是這是在Map API 2中,所以提前很抱歉。
var normal_icon = new GIcon();
normal_icon.image = "images/google_marker_green.png";
normal_icon.shadow = "images/shadow-google_marker_green.png";
normal_icon.iconSize = new GSize(20.0, 34.0);
normal_icon.shadowSize = new GSize(38.0, 34.0);
normal_icon.iconAnchor = new GPoint(10.0, 17.0);
normal_icon.infoWindowAnchor = new GPoint(10.0, 17.0);
var hover_icon = new GIcon();
hover_icon.image = "images/google_marker_blue.png";
hover_icon.shadow = "images/shadow-google_marker_blue.png";
hover_icon.iconSize = new GSize(20.0, 34.0);
hover_icon.shadowSize = new GSize(38.0, 34.0);
hover_icon.iconAnchor = new GPoint(10.0, 17.0);
hover_icon.infoWindowAnchor = new GPoint(10.0, 17.0);
var lat="Your lat. point";
var long="Your long. point";
map = new google.maps.Map2(document.getElementById("map"));
map.setCenter(new google.maps.LatLng(lat, long), 15);
map.setUIToDefault();
var point = new GLatLng(lat,long);
var marker = new GMarker(point,normal_icon);
var message="Custom message";
GEvent.addListener(marker, "click", function() {
map.openInfoWindowHtml(point, message);
});
map.addOverlay(marker);
function bindInfoWindow(marker, map, infoWindow, html) {
google.maps.event.addListener(marker, 'mouseover', function() {
marker.setIcon(hover_icon);
});
google.maps.event.addListener(marker, 'mouseout', function() {
marker.setIcon(normal_icon);
});
}
您可以找到http://smmtn.com/sandbox/gmaps-marker-hover/
感謝和問候確切的例子
Haresh
鏈接不執行......你給其他任何鏈接? – 151291 2016-10-26 06:14:30