简体   繁体   English

Google Maps JavaScript V3 Api将div放在标记上

[英]Google Maps JavaScript V3 Api place div on marker

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. 无论如何,我想在地图上放置一个div而不是一个标记。 Is this possible? 这可能吗? I did that before in Actionscript like this: markerOptions.icon = new customDisplayObject(); 我之前在ActionScript中是这样做的: markerOptions.icon = new customDisplayObject(); You were able to give some options to the marker and define a DisplayObject to it. 您可以为标记提供一些选项并为其定义DisplayObject。

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. 您的假设是错误的,您可以创建一个自定义叠加层,其中可能包含HTML标记。

Start your research at 在以下位置开始您的研究 OverlayView 叠加视图

edit: replaced old link: Google Developers: Overlay 编辑:替换旧链接: Google Developers:覆盖

Sample that draws a custom image on a map 在地图上绘制自定义图像的示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM