gpt4 book ai didi

jquery - 我为最近失去的功能开发的 map

转载 作者:行者123 更新时间:2023-12-01 01:25:40 24 4
gpt4 key购买 nike

我是我所在大学的一名网络开发人员,目前正在开发我们的 map 。网址可查here 。单击标题时,每个标题下方都会出现图钉,单击图钉(在 map 上或侧边栏中)时,应该会弹出一个信息窗口,其中包含有关位置的简短片段,通常旁边还带有照片。不幸的是,在过去的两个月里,信息窗口全部停止显示。我尝试确保我们的 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);
});

最佳答案

该问题与 jQuery 版本无关,而是 Maps-API 版本破坏了它(自 3.10 起)

你直接设置infoWindows的content-property,从3.10开始似乎失败了。

您可以修复脚本(使用 setContent() 代替)或指定 API 版本:

https://maps.googleapis.com/maps/api/js?v=3.9&sensor=false 

(但我建议修复它)

关于jquery - 我为最近失去的功能开发的 map ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14532111/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com