Google maps marker not working on iphone

2019-08-02 08:03发布

问题:

The Google map info window will not appear when I click on a marker using the iphone. The same code works on the desktop on Android.

I need the map hidden by default and then loaded in only when the user clicks the view map button as I want to keep the weight of the page down as this is for a mobile site.

The click event handler is being fired as I put an alert on it and it worked. I think it might be something to do with the order of the code when I attacked the click handlers, but thats a guess. Also, when I add draggable: true to the markers the bubble appears but I dont want the markers to be draggable.

I have set up a test page http://www.clawg.co.uk/nearby/testmap.html

A run through of this is:

  • I scan the DOM for
  • data attributes values which I use to create an array of data that will be used for info windows.
  • I create a button on the fly that will make the map appear when clicked
  • When the button is clicked the map api is loaded in if its not already available
  • The map is then loaded
  • The markers are positioned on the map

回答1:

The default marker icons are too small for iphone 4 making them unclickable, so I used a custom marker that was 42x42 in size.