谷歌地图标记不适用于iphone [英] Google maps marker not working on iphone

查看:105
本文介绍了谷歌地图标记不适用于iphone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用iphone点击标记时,Google地图信息窗口不会出现。 Android上的桌面上使用相同的代码。



我需要默认隐藏的地图,然后只在用户点击视图地图按钮时加载地图,因为我想保持页面的权重,因为这是为了一个移动网站。

点击事件处理程序正在被解雇,因为我在它上面添加了一个警报并且它工作正常。我认为这可能与我在攻击点击处理程序时的代码顺序有关,但这只是一个猜测。另外,当我添加draggable时:对于标记为真的气泡出现,但我不希望标记可拖动。



我设置了一个测试页面 http://www.clawg.co.uk/nearby/testmap.html



这个过程是:


  • 我扫描DOM中的
  • 数据属性我用它来创建一个数据数组,用于信息窗口。

  • 我创建一个按钮,可以在点击时显示地图

  • 当按钮被点击时,如果地图api尚不可用,则加载地图api

  • 然后加载地图
  • 标记定位在地图上


解决方案

iPhone 4的默认标记图标太小,无法点击,所以我使用了尺寸为42x42的自定义标记。


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

解决方案

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

这篇关于谷歌地图标记不适用于iphone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆