Christopher Pixel
Christopher Pixel

Reputation: 9

All markers on google maps api 3 map open same infowindow

I'm working on a website, one page features a styled Google map (Google maps api 3) with several markers - each has their own infowindow. On the staging site there are currently 40+ markers.

My client (chrome 49 on pc) mentioned that every marker is opening the same infowindow on click. I checked on my machine and each marker was revealing it's own infowindow as expected. I tested on my android phone and noticed both that the map was incredibly sluggish and that each marker click indeed opened the same infowindow.

My current best guess is that this is caused by low CPU devices or that I am not using the best event delegation.

Here's the code I am using to init the map and add the markers + info windows - http://pastebin.com/2RxQPWsd

Is this issue being caused by some code I can improve or is this due to limitations of the Google Maps API on low CPU devices?

Thanks!

Christopher

Upvotes: 0

Views: 89

Answers (1)

Christopher Pixel
Christopher Pixel

Reputation: 9

I am still waiting for my client to confirm this is fixed on their computer but I can confirm that I managed to fix this issue on android and ios (simulator).

I owe my solution to this previously posted stack Google Maps API v3: custom markers not clickable on mobile devices

My script was using strings for width and height of size properties and x and y of achor properties for the icons. The attached stack post mentions similar issues being resolved by changing the string to integers. Changing the strings to ints ex. "30" to 30 appears to have resolved the issue for me!

Upvotes: 0

Related Questions