Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
165
rated 0 times [  171] [ 6]  / answers: 1 / hits: 180450  / 12 Years ago, sat, june 16, 2012, 12:00:00

May I know a way to change the Google Map marker color via Javascript.. I am new at this and any help would be much appreciated, Thank you.



I used the following code to create a marker



 marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1],
locations[i][2]),
animation: google.maps.Animation.DROP,
map: map
});

More From » google-maps

 Answers
8

In Google Maps API v3 you can try changing marker icon. For example for green icon use:



marker.setIcon('http://maps.google.com/mapfiles/ms/icons/green-dot.png')


Or as part of marker init:



marker = new google.maps.Marker({
icon: 'http://...'
});


Other colors:





Etc.


[#84863] Thursday, June 14, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
whitney

Total Points: 642
Total Questions: 110
Total Answers: 98

Location: Solomon Islands
Member since Mon, Jun 20, 2022
2 Years ago
;