Google Maps JavaScript V3 Api将标记放置在div上 [英] Google Maps JavaScript V3 Api place div on marker

查看:99
本文介绍了Google Maps JavaScript V3 Api将标记放置在div上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得很奇怪,之前没有人需要这个(我认为这是因为我没有找到关于这个主题的任何内容......)。

无论如何,我想在地图上放一个div而不是标记。这可能吗?我之前在Actionscript中这样做过: markerOptions.icon = new customDisplayObject(); 您可以给标记提供一些选项并为其定义一个DisplayObject。所以我现在想要的是,我可以把:

 < p 

DIV>
< p>一些文字。< / p>
< / div>

而不是地图上的标记。



感谢!

解决方案

您的假设是错误的,您可能会创建一个可能包含HTML标记的自定义覆盖。 >

OverlayView



编辑:替换旧链接: Google Developers:Overlay



在地图上绘制自定义图像的示例


I find it strange that no one needed this before (I assume this, because I didn't find anything about this subject ...).

Anyways, I want to put a div instead of a marker on a map. Is this possible? I did that before in Actionscript like this: markerOptions.icon = new customDisplayObject(); You were able to give some options to the marker and define a DisplayObject to it.

So what I want now is that I can put:

<div>
    <p>Some text.</p>
</div>

instead of a marker on the map.

Thanks!

解决方案

Your assumption is wrong, you may create a custom overlay which may contain HTML-markup.

Start your research at OverlayView

edit: replaced old link: Google Developers: Overlay

Sample that draws a custom image on a map

这篇关于Google Maps JavaScript V3 Api将标记放置在div上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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