Google map's marker doesn't display InfoBubble on iPhone/iPad

天涯浪子 提交于 2021-01-27 17:16:22

问题


Everything about Google map works fine in different desktop browsers even in smaller screen - initialise, markers, infobubbles etc are working perfectly. But on iPhone/iPad, the InfoBubble doesn't appear when the marker is clicked.

After research on Stackoverflow and followed the various solutions:

  1. Google Map Infowindow not showing properly
  2. Google Maps API v3: InfoWindow not sizing correctly
  3. Why does Safari on the iPad not display my marker on an embedded Google Maps page?
  4. how can i bind touch events for a marker in google maps?
  5. click event is not working in ipad

The problem remained. Anyone can help? Thank you in advanced!

//set up infobubble
var infowindow = new InfoBubble({
    map: map,
    maxHeight: 380,
    minWidth: 270,
    shadowStyle: 0,
    pixelOffset: new google.maps.Size(0, 35),
    padding: 0,
    borderRadius: 0,
    arrowSize: 8,
    borderWidth: 0,
    borderColor: '#fff',
    disableAutoPan: true,
    hideCloseButton: true,
    arrowPosition: 50,
    arrowStyle: 0
});

// open infowindow when marker is clicked
var mm=[];
google.maps.event.addListener(marker, 'click', (function(marker, i) {
  return function()
  {
    if(mm !='')
    {
      mm[0].setVisible(true);
      mm=[];
    }
    mm.push(marker);
    marker.setVisible(false);
    infowindow.setContent(this.IWcontent);
    infowindow.open(map, marker);
  }
})(marker, i));

回答1:


Just in case anyone is facing this similar problem. It takes us 3 days to solve this problem. Our approaches are:

  1. load google map api via http
  2. load the map earlier than infobubble.js without using async or defer


来源:https://stackoverflow.com/questions/46237734/google-maps-marker-doesnt-display-infobubble-on-iphone-ipad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!