如何获取Google Maps标记的HTML DOM元素? [英] How to obtain the HTML DOM element of a Google Maps marker?
问题描述
< div>
插入到地图中。 谢谢。
看起来Google Maps API没有提供返回标记的DOM元素的方法。
您只想创建自己的自定义标记?如果是这样,您可以创建一个扩展GOverlay的标记类。 MarkerLight 是一个很好的例子,说明如何完成这个(和以下是示例页面)。
如果您需要的是一个自定义图标,这里是如何做到的。
Given a GMarker JS variable, how do I obtain the HTML DOM element that represents it? I need this so I can insert a <div>
of my own into the map with the correct z-index.
Thanks.
It looks like the Google Maps API doesn't provide a method to return a marker's DOM element.
Do you just want to create your own custom marker? If so, you can create a marker class which extends GOverlay. MarkerLight is a great example of how to accomplish this (and here is the example page).
If all you need is a custom icon, here is how to do that.
这篇关于如何获取Google Maps标记的HTML DOM元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!