问题描述
如何将标题添加到google.maps.Rectangle和google.maps.Polygon? title属性在中不可用。我试过了,它不起作用
(google.maps.Marker是可能的,所以我猜它应该是矩形和多边形)。
如何获取Google地图矩形/多边形的DOM元素?。 解决方案 div>
您可以使用()。这有点复杂,但通过设置正确的选项,您可以使它看起来更像浏览器工具提示,而不是我所展示的内容。
How can I add title to google.maps.Rectangle and google.maps.Polygon? The title attribute is not available within RectangleOptions. I tried it and it doesn't work(it is possible for google.maps.Marker, so I guess it should be for rectangle and polygon too).
If there is no clean solution via google maps, woudln't it be possible to just get the DOM element of the rectangle and add title attribute with jQuery? So we might possibly reduce the question to "How to get the DOM element of google maps rectangle/polygon?"
You can mimic the "title" tooltip with InfoBox (download here). It's a bit convoluted, but by setting the right options you can make it look more like a browser tooltip than what I'm showing.
这篇关于谷歌地图与标题的矩形/多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!