Hi All,
About a month ago the infoWindow popups on our map stopped popping up.
No code has changed and no errors popup when the items are clicked,
just nothing happens.
We've ran some test and found that it seems as though the our
addListener function is not firing on the MarkerIds. When we replace
the object in the addListener function to 'map', for instance, it
works fine. We've tested that the functions are still passing the
markerId successfully and all seems good.
Our code loops through an array of locations to get their properties
(lat, long, hours of operation, etc) and sets the the marker location
based on the lat/long. As I've said this has been working for almost 2
years and suddenly stopped. The search and the results of the search,
directions and everything else still works.
Here is the code (with a sample array value) - the URL is
www.tacotimenw.com/findatacotime.aspx:
var locations = [
['Tacoma - 19th & Mildred', 47.242444, -122.525472, '6618 19th Street
W<br/>Fircrest, WA 98466<br/><strong>Phone:
253.565.4331<br/>Fax:
253.565.8190</strong>', 'Call for hours.', 'Fax Orders Available'],
['Tacoma - 6th Avenue', 47.2556334, -122.4975225, '4427 6th Avenue<br/
>Tacoma, WA 98406<br/><strong>Phone:
253.752.8790<br/>Fax:
253.752.5210</strong>', 'Call for hours.', 'Fax Orders Available'],
];
function setMarkers() {
//add location markers
var cactusImage = new google.maps.MarkerImage(imageURL, new
google.maps.Size(26, 56), new google.maps.Point(0, 0), new
google.maps.Point(12, 51));
var imageShape = { coord: [0, 0, 26, 56], type: 'rectangle' };
for (var i = 0; i < locations.length; i++) {
var location = locations[i];
var locationLatLng = new google.maps.LatLng(location[1],
location[2]);
window["marker" + i] = new google.maps.Marker({
position: locationLatLng,
map: map,
icon: cactusImage,
shape: imageShape,
title: location[0]
});
var markerPosition = window["marker" + i].getPosition();
window["info" + i] = new google.maps.InfoWindow({ content: "<p
class='mapdetail'><strong>" + location[0] + "</strong><br/>" +
location[3] + "<br/>" +location[4]+ "</p>", disableAutoPan: true,
maxWidth: 250, pixelOffset: new google.maps.Size(0, 56, "px",
"px") });
callMarkerEvent(window["marker" + i], window["info" + i]);
}
}
function callMarkerEvent(markerId, windowId) {
//alert(markerId.getPosition());
google.maps.event.addListener(markerId, 'click', function() {
alert(markerId.getPosition());
map.setCenter(markerId.getPosition());
windowId.open(map, markerId);
});
}
Thanks for any light you can shed on this.