我知道这已经在网上被问了很多次了。但是我仍然无法解决这个问题,已经有几天了,但我仍然无法解决。我对这个谷歌地图 API 还是很陌生,也许有一些我混淆了。
以下是我当前的代码:
var places = [
['Car Park', 1.301526,103.849379, 4],
['Bus Stop', 1.301132,103.850077, 3],
['MRT', 1.298515,103.845785, 2],
['Success Human Resource Center', 1.301486,103.849712, 1]
];
var companyImage0 = new google.maps.MarkerImage('images/map-icon.png',
new google.maps.Size(54,62),
new google.maps.Point(0,0),
new google.maps.Point(50,50)
);
var companyImage1 = new google.maps.MarkerImage('images/MRT.png',
new google.maps.Size(30,30),
new google.maps.Point(0,0),
new google.maps.Point(50,50)
);
var companyImage2 = new google.maps.MarkerImage('images/bus-stop.png',
new google.maps.Size(30,33),
new google.maps.Point(0,0),
new google.maps.Point(50,50)
);
var companyImage3 = new google.maps.MarkerImage('images/car-park.png',
new google.maps.Size(30,30),
new google.maps.Point(0,0),
new google.maps.Point(50,50)
);
var companyShadow = new google.maps.MarkerImage('images/logo_shadow.png',
new google.maps.Size(54,62),
new google.maps.Point(0,0),
new google.maps.Point(65, 50)
);
/*var companyPos = new google.maps.LatLng(1.301486,103.849712);*/
for (var i = 0; i < places.length; i++) {
var place = places[i];
var myLatLng = new google.maps.LatLng(place[1],place[2]);
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
shadow: companyShadow,
icon: companyImage[i],
title: 'Singapore',
zIndex: places[2][2]});
}
除此之外,我只想在用户单击 SHRC 标记时显示信息窗口,单击标记时巴士站和 MRT 将一无所有。
感谢任何可以帮助我解决这个问题的好心人。提前致谢。