I am adding these two google.maps.event.addListener events
google.maps.event.addListener(markerAcademicCenter, \"mouseover\", function (e) {
markerIconAcademi
The icon of a marker is not an MVCObject, the API will not observe changes of the icon-properties.
You must modify the url
of the icon and then call setIcon
to apply the changes:
google.maps.event.addListener(markerAcademicCenter, "mouseover", function (e) {
var icon = this.getIcon();
icon.url = 'url/to/icon';
this.setIcon(icon);
});
But I wouldn't suggest it, when you use the icon for multiple markers changing the url
(or other properties) will affect the original icon markerIconAcademicCenter
(markers use a reference to the original object). You better create a copy with a modified url:
google.maps.event.addListener(markerAcademicCenter, "mouseover", function (e) {
var icon = this.getIcon(),copy={};
for(var k in icon){
copy[k]=icon[k];
}
copy.url= 'url/to/icon';
this.setIcon(copy);
});