我在信息窗口中显示数据时遇到问题。我试图从谷歌的默认信息窗口转到模式如弹出窗口。问题是因为没有显示相关的标记数据,但是所有标记的信息都相同。这是代码:
drr = '<div>' +
'<table>' +
'<tr style="height: 25px">' +
'<td><label style="width: 70px;font-weight: 100;float: left;font-size: 13px;">' + lan[17] + ': </label></td>' +
'<td><label style="width: 205px;font-size: 13px;color: #1faac0;border-bottom: 1px solid #1faac0;text-align: center;"> ' + projectnearby.PREQDETAILS[0].PROJECTS[q].PROID + '</label></td>' +
'</tr>' +
'<tr style="height: 25px">' +
'<td><label style="width: 75px;font-weight: 100;font-size: 13px;">' + lan[18] + ': </label></td>' +
'<td><label style="width: 205px;font-size: 13px;color: #1faac0;border-bottom: 1px solid #1faac0;text-align: center;"> ' + adresa + '</label></td>' +
'</tr>' +
'<tr style="height: 25px">' +
'<td><label style="width: 75px; font-weight: 100;font-size: 13px;">' + lan[19] + ': </label></td>' +
'<td><label style="width: 205px;font-size: 13px;color: #1faac0;border-bottom: 1px solid #1faac0;text-align: center;"> ' + schedule + '</label></td>' +
'</tr>' +
'</table>' +
'</div>';
var header6 = '<label onclick="changepro1(' + projectnearby.PREQDETAILS[0].PROJECTS[q].POSID + ')" style="float: left;text-decoration: underline;cursor: pointer;padding-right: 0px;color: #2d2d2d;font-size: 16px;margin-top: 5px;">' + projectnearby.PREQDETAILS[0].PROJECTS[q].POSID + '-' + projectnearby.PREQDETAILS[0].PROJECTS[q].PROBEZ + '</label>';
var infowindowsproject = new google.maps.InfoWindow({
PROID: projectnearby.PREQDETAILS[0].PROJECTS[q].PROID,
position: new google.maps.LatLng(projectnearby.PREQDETAILS[0].PROJECTS[q].LATITUDE, projectnearby.PREQDETAILS[0].PROJECTS[q].LONGITUDE)
});
infowindowsprojectnear.push(infowindowsproject);
markprojectnear.push(markerproject);
}
markprojectnear.forEach(function(markernear, index) {
google.maps.event.addListener(markernear, 'click', function(event) {
infowindowsprojectnear.forEach(function(projectnear, index) {
if (projectnear.PROID == markernear.PROID) {
// projectnear.open(map,markernear);
//design();
console.log(markernear.PROID);
$(".modal-title").html(header6);
$(".modal-body").html(drr);
$("#myModal").modal('show');
if (!infowindowselected) {
infowindowselected = projectnear;
} else {
if (projectnear.PROID != infowindowselected.PROID) {
cleareinfowindow();
infowindowselected = projectnear;
}
}
}
});
});
});
提前谢谢!