简体   繁体   English

如何使用GoogleMaps API在标记和信息窗口之间创建内容

[英]How to create something in between a marker and infowindow with googlemaps api

I need to create markers for my map that contain html. 我需要为我的地图创建包含html的标记。 After looking at lots of tutorials, it seems like markers are made of an image, and do not allow html to be added. 看了很多教程之后,似乎标记是由图像组成的,并且不允许添加html。

InfoWindows half solve my problem, I know I can add multiple instances of them, but my problem is I need to be able to stylize them, and I don't want close buttons on them. InfoWindows一半解决了我的问题,我知道我可以添加它们的多个实例,但是我的问题是我需要能够对其进行样式化,并且我不希望它们上的关闭按钮。

Can anyone advize me as to the best approach to take. 谁能建议我采取最佳方法。

I am currently thinking I have three options: 我目前正在考虑三种选择:

  1. edit markers so they can contain html. 编辑标记,以便它们可以包含h​​tml。
  2. edit infowindows so they look like i want and dont have a close button. 编辑信息窗口,使它们看起来像我想要的并且没有关闭按钮。
  3. create something seperate, and try and tie its location to the map dynamically. 创建单独的内容,然后尝试将其位置动态地关联到地图。

Any advice would be greatfully recieved. 任何建议将不胜感激。

Would something like the ELabel work for you?. ELabel这样的东西对您有用吗? It's implemented like this: 它是这样实现的:

var label = new ELabel(new GLatLng(44.3,-78.8), "Your HTML String", "styleName");
map.addOverlay(label);

And here's the example . 这是例子

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

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