我成功地将谷歌地图api嵌入了#34; mapseasy.com"脚本。
但是他们的生成器只有一个位置的信息......我需要使用这个地图并有多个位置。
注意: http://mesgolf.com/course-flyover.php
我想添加另一个PIN ...任何人都知道如何完成此操作?
目前的JS是:
function LoadGmaps() {
var myLatlng = new google.maps.LatLng(40.6094825,-73.7280392);
var myOptions = {
zoom: 10,
center: myLatlng,
disableDefaultUI: true,
navigationControl: false,
mapTypeControl: false,
streetViewControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("MyGmaps"), myOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title:"Lawrence Yacht & Country Club"
});
var infowindow = new google.maps.InfoWindow({
content: "<strong>Lawrence Yacht & Country Club</strong><br /><a href=\"https://www.youtube.com/watch?v=7u5kICTb1Qs\" target=\"_blank\" style=\"text-decoration:underline; color:#2a5b2a;\">View Course Flyover</a><br /><br />"
});
google.maps.event.addListener(marker, "click", function() {
infowindow.open(map, marker);
});
}
我将给出另一个长/拉的位置示例:40.65063,-73.528508
HTML看起来像这样:
<div id="MyGmaps" style="width:100%;height:100%; position:absolute;"></div>
答案 0 :(得分:0)
请参阅documentation of the Google Maps Javascript API v3 on Markers
var marker2 = new google.maps.Marker({
position: new google.maps.LatLng(40.65063,-73.528508),
map: map,
title:"marker 2"
});
var infowindow2 = new google.maps.InfoWindow({
content: "<strong>Marker 2</strong><br />more information<br /><br />"
});
google.maps.event.addListener(marker2, "click", function() {
infowindow2.open(map, marker2);
});