Javascript 如何在谷歌地图API中添加移动标记的信息窗口?
我正在创建一个项目,我想在其中添加信息窗口到谷歌地图API中的移动标记。 但我无法在船上添加相同的 在线标记代码:Javascript 如何在谷歌地图API中添加移动标记的信息窗口?,javascript,google-maps-api-3,google-maps-markers,Javascript,Google Maps Api 3,Google Maps Markers,我正在创建一个项目,我想在其中添加信息窗口到谷歌地图API中的移动标记。 但我无法在船上添加相同的 在线标记代码: for (var i = 0; i < DrivePath.length-1; i++) { var line = new google.maps.Polyline({ path: [DrivePath[i], DrivePath[i+1]], icons: [ { icon: symbolShape, offset: '0
for (var i = 0; i < DrivePath.length-1; i++) {
var line = new google.maps.Polyline({
path: [DrivePath[i], DrivePath[i+1]],
icons: [
{
icon: symbolShape,
offset: '0%'
}
],
strokeColor: Colors[i],
strokeOpacity: 0.0,
strokeWeight: 2,
map: map
});
lineArray[i] = line;
google.maps.event.addListener(line, 'click', function() {
infowindow.open(map,line);
});
}
for (var i = 0; i < DrivePath.length-1; i++) {
line1 = new google.maps.Polyline({
path: [DrivePath[i], DrivePath[i+1]],
icons: [
{
icon: symbolSource,
offset: '0%'
}, {
icon: symbolDestination,
offset: '100%'
}
],
strokeColor: Colors[i],
strokeOpacity: 1.0,
strokeWeight: 2,
map: map
});
lineArray1[i] = line1;
}
console.log(lineArray.length);
console.log(lineArray1.length);
//Map boundaries
var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < line.getPath().getLength(); i++) {
bounds.extend(line.getPath().getAt(i));
}
map.fitBounds(bounds);
for(变量i=0;i
整个代码在
您的小提琴不起作用
未捕获的语法错误:意外标记请提供一个演示该问题的标记。什么是DrivePath
?可能重复JSFIDLE代码中所做的必要更改@geocodezipYour fiddle不起作用未捕获的语法错误:意外标记请提供一个示例来说明问题。什么是DrivePath
?可能重复JSFIDLE代码中所做的必要更改@地理编码