아이콘 색상을 쉽게 변경하려면 어떻게해야하나요? 나는 단지 googles 표준 마커를 사용하여 다른 색상으로 바꿀 수 있기를 원합니 까? var = marker .....를 사용하여 마커를 만들 때 색상을 선언 할 수있는 방법이 있습니까?Google지도 아이콘 색상 변경
<script type="text/javascript">
var map = null;
function initialize() {
var myOptions = {
zoom: 5,
center: new google.maps.LatLng(54.2361100,-4.5480600),
mapTypeControl: true,
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
navigationControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
google.maps.event.addListener(map, 'click', function() {
infowindow.close();
});
var point = new google.maps.LatLng(50.7184100,-3.5339000);
var marker = createMarker(point,'<div style="width:200px"><h2>text</h2><\/div>')
var point = new google.maps.LatLng(50.9097000,-1.4043500);
var marker = createMarker(point,'<div style="width:200px"><h2>text</h2><\/div>')
}
var infowindow = new google.maps.InfoWindow(
{
size: new google.maps.Size(150,50)
});
function createMarker(latlng, html) {
var contentString = html;
var marker = new google.maps.Marker({
position: latlng,
map: map,
zIndex: Math.round(latlng.lat()*-100000)<<5
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(contentString);
infowindow.open(map,marker);
});
}
</script>
</head>
<body style="margin:0px; padding:0px;" onload="initialize()">
<div id="map_canvas" style="width: 535px; height: 500px"></div>
http://stackoverflow.com/questions/2472957/how-can-i-change-the-color-of-a-google-maps-marker -이 외의 다른 작업을 수행해야합니까? – Knightsy
예. 나는 그것을 작동시키지 못한다. Var marker = createMarker 뒤에 코드를 넣으려고했습니다. ???? – user2208358