[英]Display an InfoWindow for 5 markers on Google Maps, the Infowindow is a chart
[英]Add infowindow for existing markers in google maps API
我正在使用javascript中的Google Maps API。 我能夠找到從一個點到另一個點的路線。 但是,我需要編輯為位置上的標記顯示的信息窗口。 顯示的默認信息會顯示您的地點名稱,是否可以更改該信息以顯示其他內容?
是的,您可以使用信息窗口執行各種操作:
請參閱https://developers.google.com/maps/documentation/javascript/examples/infowindow-simple作為參考。
信息窗口中一些自定義html的示例:
var infoWindowContent = '<div id="map-player-info-content">' +
'<img class="player-pic" ng-src="' + (playerList[i].profilePic || 'img/smash-app-icon.png') + '">' +
'<p><span class="text-bold">Player:</span> ' + playerList[i].tag + '</p>' +
'<p><span class="text-bold">Game(s):</span> ' + playerList[i].games + '</p>' +
'<p><span class="text-bold">Main(s):</span> ' + playerList[i].mains + '</p>' +
'</div>';
var infowindow = new google.maps.InfoWindow({
content: infoWindowContent
});
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Uluru (Ayers Rock)'
});
google.maps.event.addListener(marker, 'click', function () {
infowindow.open(map, marker);
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.