Closed resqonline closed 6 years ago
Looking at the whole script, the markers
variable appears to be set to []
? Do you need to use $markers
instead (and is this an array of Google Maps Marker objects, as it will need to be)?
yes it is an array of marker objects
@jawj just noticed that the error only occurs on start page with the map, it seems on sub-pages (taxonomies and such) everything is fine. I am using the same template tag on all pages including start page, so I am not sure, why it throws an error on the front page but not on other pages.
@jawj finally found the issue! it seems it mattered, how and when the individual functions were called... good heavens, this is why I don't like JS 😄
I am having trouble with the spiderfier - as soon as I activate it, the map won't center and fit to the bounds, instead it just shows somewhere around the equator (the blackened part is where my json file does an overlay)
I am not getting any errors in the console, though. As soon as I deactivate the spiderfying, the whole map shows up correctly. But I need a solution to show overlapping markers (sometimes there are five or more in the same spot). I am using Advanced Custom Fields plugin in WordPress to manage the markers with the Google Maps field and included the Spiderfier function like this:
You can take a look at the whole skript here: https://github.com/resqonline/code-snippets/blob/master/google-maps.js