谷歌地图标记不适用于iphone [英] Google maps marker not working on iphone
问题描述
使用iphone点击标记时,Google地图信息窗口不会出现。 Android上的桌面上使用相同的代码。
我需要默认隐藏的地图,然后只在用户点击视图地图按钮时加载地图,因为我想保持页面的权重,因为这是为了一个移动网站。
点击事件处理程序正在被解雇,因为我在它上面添加了一个警报并且它工作正常。我认为这可能与我在攻击点击处理程序时的代码顺序有关,但这只是一个猜测。另外,当我添加draggable时:对于标记为真的气泡出现,但我不希望标记可拖动。
我设置了一个测试页面 http://www.clawg.co.uk/nearby/testmap.html
这个过程是:
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屋!