Reputation: 1203
Wrote the following code:
GEvent.addListener(marker, "click", function() {
// Delete all markers.
map.clearOverlays();
jQuery(points_array).each(function(i, point) {
map.addOverlay(new GMarker(point.coord, {icon : myIcon}));
});
map.addOverlay(new GMarker(marker.getLatLng(), {icon : activeIcon}));
map.panTo(marker.getLatLng());
});
But he is not working properly. And like all logical. Remove all tags. Put a scratch. And add the one with the other icon.
Tell me, what I'm doing is wrong. And is there some other, simpler ways to solve this problem?
Upvotes: 0
Views: 349
Reputation: 130
You should use this:
var markerHighlight = new google.maps.MarkerImage(site_hUrl, new google.maps.Size(32, 36));
marker.addListener('click', function(marker) {
marker.setIcon(markerHighlight);
}
Where site_hUrl is the url of the new icon you wish to replace. Thats all.
Upvotes: 1