We got a google maps with a bunch of pins. Each pin is setup to use our blue custom icon image.
I'm trying to make it so that when you click on a pin, that particular pin changes to a green version of the icon, and all the reset stay blue. If the user clicks another pin, it turns green and the previous goes back to blue.
Basicly only the clicked active pin should be green.
Here is my code so far that will change the clicked pin into a green version.
My problem is all attempts to change all pins back to blue prior to changing this clicked pin to green fails bad.
Anyone know how to do this or point me in the right direction?
I'm trying to make it so that when you click on a pin, that particular pin changes to a green version of the icon, and all the reset stay blue. If the user clicks another pin, it turns green and the previous goes back to blue.
Basicly only the clicked active pin should be green.
Code:
google.maps.event.addListener(markers[indx], 'click', function() { this.setIcon("/images/greenmarker.png"); });
My problem is all attempts to change all pins back to blue prior to changing this clicked pin to green fails bad.
Anyone know how to do this or point me in the right direction?
Comment