换上了谷歌地图顶部的按钮 [英] Put a button on top of a google map

查看:159
本文介绍了换上了谷歌地图顶部的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提出一个按钮在谷歌地图上方旁边的地图,卫星和混合按钮。

I would like to put a button on top of a Google Map next to the Map, Satelite and Hybrid buttons.

我在想,如果可能,如何将做到这一点的最好方法是什么?

I was wondering if its possible and how would be the best way to do it?

所以我的想法是有覆盖在谷歌地图是可以点击的,但不能确定顶部的形象是否会采取一切事件远离谷歌地图。

So ideas I have are overlaying a image on top of the google map that is clickable but not sure if that will take all the events away from the google map.

你有没有关于它如何做任何想法?

Do you have any ideas on how it could be done?

问候

标记

推荐答案

有是如何做到这一点的这里

There is a pretty good description of how to do this here.

我是pretty确保您可以风格这些家伙看起来像标准的按钮,你可以肯定它锚定到右上角。当我得到一个机会,我给它一个尝试,更新我的结果。

I am pretty sure you can style these guys to look like the standard buttons and you can definitely anchor it to the top right. When I get a chance I'll give it a try and update with my results.

更新:

我有机会尝试了这一点,它工作确定:

I had a chance to try this out and it works ok:

  • Map example with Google style buttons
  • Javascript Source

基本上,你最终会做实现使用GControl的按钮非常相似的事物或只使用一个DIV绝对定位在地图上(作为的 ChrisB 的建议)。因此,我不认为这是一个正确的(或更容易)的方法,它只是一个个人的preference的问题。祝你好运。

Basically you end up doing very similar things implementing the buttons using GControl or just using absolute positioning of a DIV over the map (as ChrisB suggested). So I don't think there is a correct (or easier) approach, it's just a matter of personal preference. Good luck.

这篇关于换上了谷歌地图顶部的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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