谷歌地图与标题的矩形/多边形 [英] Google maps rectangle/polygon with title

查看:107
本文介绍了谷歌地图与标题的矩形/多边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将标题添加到google.maps.Rectangle和google.maps.Polygon? title属性在 RectangleOptions 中不可用。我试过了,它不起作用
(google.maps.Marker是可能的,所以我猜它应该是矩形和多边形)。



<如果没有通过谷歌地图的干净的解决方案,不可能只是得到矩形的DOM元素,并添加标题属性与jQuery?因此,我们可能会将问题简化为如何获取Google地图矩形/多边形的DOM元素?。

解决方案 div>

您可以使用 InfoBox 下载这里)。这有点复杂,但通过设置正确的选项,您可以使它看起来更像浏览器工具提示,而不是我所展示的内容。


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.

http://jsfiddle.net/vF7u2/

这篇关于谷歌地图与标题的矩形/多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆