【发布时间】:2016-11-22 14:25:36
【问题描述】:
我在 Google 地图上使用 v3,并且我的网站没有任何代码更改。今天我看到,功能可能被谷歌改变了,或者什么。
我正在使用这样的东西:
var m = new google.maps.Marker({
position: new google.maps.LatLng(b[0], b[1]),
map: map,
icon: img,
label: " <strong>" + b[4] + "</strong><br />Autor: <strong>" + b[5] + "</strong><br />Dĺžka: <strong>" + b[6].replace('.', ',') + " km</strong>"
});
看起来像:
当我将鼠标悬停在标记上时,它就像:
这没关系,但在这两种情况下,还显示了来自 marker.label 的文本,而几天前还没有这样显示。当标记悬停时,它与气泡中显示的文本相同。
当我在 SO 上搜索一个小时时,我也尝试将 marker.label 更改为对象:
var m = new google.maps.Marker({
position: new google.maps.LatLng(b[0], b[1]),
map: map,
icon: img,
label: { text: " <strong>" + b[4] + "</strong><br />Autor: <strong>" + b[5] + "</strong><br />Dĺžka: <strong>" + b[6].replace('.', ',') + " km</strong>" }
});
但地图上的文字仍然显示,然后在气泡中只显示[object Object]。
问题
有谁知道这可能是什么问题,或者谷歌在他们的 v3 API 中改变了什么?
无法将这么大的代码粘贴到 JSFiddle 中,希望您理解。网址是www.cyklomapy.sk。
非常感谢遇到类似问题的任何人的帮助。
【问题讨论】:
-
我的问题不是关于,为什么我的代码不能工作...关于,它不能在所有使用谷歌地图 API v3 的网站上工作!
-
请提供证明问题的minimal reproducible example,而不是(仅)指向损坏网站的链接。
标签: javascript google-maps google-maps-api-3 google-maps-markers