我是我大学的网络开发人员,目前正在研究我们的地图。该网站可以在这里找到。单击标题时,每个标题下都会出现图钉,当单击图钉时(在地图上或侧边栏中),应该会弹出一个信息窗口,其中包含有关该位置的简短片段,通常旁边有一张照片。不幸的是,在过去的两个月里,信息窗口都停止了显示。我已经尝试确保我们的 jquery 是最新的,并运行我们制作的自定义 javascript 以查看是否有任何重大更改(我可以说最好,没有)。我想知道 Google Maps API 最近是否有任何可能破坏这一点的更新。我正在逐步执行脚本,试图找出潜在的问题区域,但结果很枯燥。
(编辑)我会把相关代码贴到infowindows上,不然大家都头疼。
for (var i in data.d.Buildings) {
var color = categories[4].Color.substring(1);
var myLatLng = new google.maps.LatLng(data.d.Buildings[i].Latitude, data.d.Buildings[i].Longitude);
var image = 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=' + data.d.Buildings[i].LegendKey + '|' + color + '|ffffff';
categoryItems['search'][i].marker = new google.maps.Marker({
position: myLatLng,
map: map,
icon: image,
pushpinInfo: data.d.Buildings[i]
});
google.maps.event.addListener(categoryItems['search'][i].marker, 'click', function () {
infowindow.content = '<div class="bubble"><h3>' + this.pushpinInfo.Name + '</h3>' + (this.pushpinInfo.ImageUrl != null ? '<img src="' + this.pushpinInfo.ImageUrl + '" alt="' + this.pushpinInfo.Acronym + '" />' : '') + this.pushpinInfo.Description + '</div>';
infowindow.open(map, this);
});
addPushpinToMenu(categoryItems['search'][i], 'search', image);
count++;
}
if (data.d.ParkingLots[i].Name != null && data.d.ParkingLots[i].Name != "") {
google.maps.event.addListener(categoryItems['search'][count].marker, 'click', function () {
infowindow.content = '<div class="bubble">' + (this.pushpinInfo.Name != null ? '<h3>' + this.pushpinInfo.Name + '</h3>' : '') + (this.pushpinInfo.Description != null ? this.pushpinInfo.Description : '') + '</div>';
infowindow.setPosition(this.centerLatLng);
infowindow.open(map);
});
}
google.maps.event.addListener(categoryItems['search'][count].marker, 'click', function () {
infowindow.content = '<div class="bubble"><h3>' + this.pushpinInfo.Name + '</h3>' + (this.pushpinInfo.ImageUrl != null ? '<img src="' + this.pushpinInfo.ImageUrl + '" alt="' + this.pushpinInfo.Acronym + '" />' : '') + this.pushpinInfo.Description + '</div>';
infowindow.open(map, this);
});
if (data.d[i].ParkingLots[a].Name != null && data.d[i].ParkingLots[a].Name != "") {
google.maps.event.addListener(categoryItems[6][i].ParkingLots[a].marker, 'click', function () {
infowindow.content = '<div class="bubble">' + (this.pushpinInfo.Name != null ? '<h3>' + this.pushpinInfo.Name + '</h3>' : '') + (this.pushpinInfo.Description != null ? this.pushpinInfo.Description : '') + '</div>';
infowindow.setPosition(this.centerLatLng);
infowindow.open(map);
});
}
google.maps.event.addListener(categoryItems[data.d[0].TypeID][i].marker, 'click', function () {
infowindow.content = '<div class="bubble"><h3>' + this.pushpinInfo.Name + '</h3>' + (this.pushpinInfo.ImageUrl != null ? '<img src="' + this.pushpinInfo.ImageUrl + '" alt="' + this.pushpinInfo.Name + '" />' : '') + this.pushpinInfo.Description + '</div>';
infowindow.open(map, this);
});