infoWindows suddenly not working

58 views
Skip to first unread message

bsi

unread,
Oct 10, 2011, 5:30:44 PM10/10/11
to Google Maps JavaScript API v3
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.

geoco...@gmail.com

unread,
Oct 10, 2011, 6:46:47 PM10/10/11
to Google Maps JavaScript API v3
On Oct 10, 2:30 pm, bsi <i...@brightspectrum.net> wrote:
> 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

http://www.tacotimenw.com/findatacotime.aspx

>


>
> Thanks for any light you can shed on this.

You are using the "nightly/development" version of the API. Have you
tried using 3.4 or 3.5 (one of the stable/frozen versions)?

http://code.google.com/apis/maps/documentation/javascript/basics.html#Versioning

Have you tried optimized: false on your markers (that will help if it
is a CANVAS issue)?

-- Larry

geoco...@gmail.com

unread,
Oct 10, 2011, 7:36:16 PM10/10/11
to Google Maps JavaScript API v3
On Oct 10, 3:46 pm, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
> http://code.google.com/apis/maps/documentation/javascript/basics.html...
>
> Have you tried optimized: false on your markers (that will help if it
> is a CANVAS issue)?

Seems that for you, the optional "scaledSize" argument to the
MarkerImage constructor is no longer optional, if I add that to a
local copy, it starts working.

-- Larry

geoco...@gmail.com

unread,
Oct 10, 2011, 7:39:41 PM10/10/11
to Google Maps JavaScript API v3
On Oct 10, 4:36 pm, "geocode...@gmail.com" <geocode...@gmail.com>
Online version, points to most of the resources from your site.

http://www.geocodezip.com/www_tacotimenw_com_findatacotimeA.html

  -- Larry

bsi

unread,
Oct 10, 2011, 7:49:18 PM10/10/11
to Google Maps JavaScript API v3
Wow! Thanks a million Larry. I would not have ever figured that out. I
know your not with Google but it's not typical that they would just
make a random change like that is it? We were previously on 3.2 when
it stopped working I moved it up to 3.4 just to see if the change make
a difference.

Thanks again!

On Oct 10, 4:39 pm, "geocode...@gmail.com" <geocode...@gmail.com>

Enoch Lau (Google Employee)

unread,
Oct 10, 2011, 8:25:40 PM10/10/11
to google-map...@googlegroups.com
http://code.google.com/apis/maps/documentation/javascript/reference.html#MarkerImage does define it as optional. Would you be able to make a small demo that shows off the problem when scaledSize is not provided (vs when it is provided) please?

Enoch

geoco...@gmail.com

unread,
Oct 10, 2011, 9:06:33 PM10/10/11
to Google Maps JavaScript API v3
On Oct 10, 5:25 pm, "Enoch Lau (Google Employee)"
<enoch...@google.com> wrote:
> http://code.google.com/apis/maps/documentation/javascript/reference.h...does
> define it as optional. Would you be able to make a small demo that shows off
> the problem when scaledSize is not provided (vs when it is provided) please?

without that argument in the call (the original problem):
http://www.geocodezip.com/www_tacotimenw_com_findatacotimeB.html

click listeners don't work.

with that argument in the call:
http://www.geocodezip.com/www_tacotimenw_com_findatacotimeA.html

click listeners work.

(warning: these pages depend on resources from the OP's site and may
stop working at any time)

-- Larry

>
> Enoch

geoco...@gmail.com

unread,
Oct 10, 2011, 9:09:21 PM10/10/11
to Google Maps JavaScript API v3
On Oct 10, 4:49 pm, bsi <i...@brightspectrum.net> wrote:
> Wow! Thanks a million Larry. I would not have ever figured that out. I
> know your not with Google but it's not typical that they would just
> make a random change like that is it? We were previously on 3.2 when
> it stopped working I moved it up to 3.4 just to see if the change make
> a difference.

v3.2 was retired a long time ago. When I first looked at your site
you weren't specifying any version, which gives you the "nightly"/
development version and is not recommended for production sites.

If you were calling for v3.2 that would have automatically served you
v3.4 starting a couple of months ago.

-- Larry
Reply all
Reply to author
Forward
0 new messages