-1
我試圖實現一個標記,把它放在不同的位置,但它沒有顯示出來。不過,它確實集中在這個地方。谷歌地圖標記不顯示
這是JavaScript我想:
google.maps.event.addDomListener(window, 'load', initMap);
var map;
var markers = [
['Kapelstraat 13', 52.408421,6.896036,21],
];
function initMap() {
var mapOptions = {
zoom: 16,
disableDoubleClickZoom: true,
draggable: true,
panControl: false,
scrollwheel: true,
zoomControl: true,
streetViewControl: false,
overviewMapControl: false,
mapTypeControl: false,
center: new google.maps.LatLng(52.408421,6.896036,21)
};
map = new google.maps.Map(document.getElementById('map-canvas'),mapOptions);
setMarkers();
}
function setMarkers(){
for (i = 0; i < markers.length; i++) {
var post = new google.maps.LatLng(markers[i][1], markers[i][2]);
var marker = new google.maps.Marker({
position: post,
map: map
});
var infowindow = new google.maps.InfoWindow({
content: markers[i][0]
});
infowindow.open(map,marker);
}
}
我沒有使用此鏈接到地圖鏈接:
<script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"type="text/javascript"></script>
預先感謝您
[發佈的代碼適用於我](http://jsfiddle.net/geocodezip/zbvajphn/)(它顯示一個標記)。請提供證明此問題的[最小,完整,測試和可讀示例](http://stackoverflow.com/help/mcve)。 – geocodezip