Google Maps JavaScript V3 Api place div on marker

微笑、不失礼 提交于 2020-01-06 12:50:27

问题


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!


回答1:


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



来源:https://stackoverflow.com/questions/9433058/google-maps-javascript-v3-api-place-div-on-marker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!