Reputation: 525
We have been working on a Google Maps API v3 based app for the past few weeks when we noticed that the click event on one type of marker had stopped working. We had changed the size and upped the number of these markers, assumed our code was bad but a revert didn't fix the issue.
Our code was fairly simple. After creating a marker (called obj in this example) we would do the following:
google.maps.event.addListener(obj, 'click',
function(coords){ localClick(coords, id); });
localClick
is one of our functions, alert('click!');
also yielded nothing.
After a few days of scratching our heads, we noticed something odd: some of the markers were working. Then we noticed a horizontal line of almost invisible markers that were clickable but in the wrong place:
This happens on all browsers on OSX (we didn't try on Windows or Linux).
One solution was to specify the version of the API you are using to v3.2. This isn't ideal as we'd like to stay up to date. And it was working on the latest edition (v3.4) until recently.
Call in the Google maps API like this and it's not working:
$.getScript("https://maps-api-ssl.google.com/maps/api/js?
sensor=false&callback=mapLoaded");
Like this and everything's great:
$.getScript("https://maps-api-ssl.google.com/maps/api/js?
sensor=false&v=3.2&callback=mapLoaded");
We're puzzled.
Unfortunately we cannot post the code or a working demo (I know this reduces the response rate, client requirements).
Upvotes: 2
Views: 1734
Reputation: 2083
If you are using custom overlays for your markers, using the wrong MapPane can be the cause of the problem. some of the panes may not receive dom events as stated in map api reference This is the only thing that comes to my mind.
Upvotes: 2