【发布时间】:2016-12-22 17:10:16
【问题描述】:
我正在使用 Google Maps API 在网站上创建带有坐标的地图。 我不知道如何在标记上添加相同的红色标签,以便在 Google 地图上进行搜索。
For example with the Eiffel Tower
我尝试使用title 选项,但是当我点击标记时它只显示一个标签。
【问题讨论】:
标签: javascript google-maps google-maps-api-3
我正在使用 Google Maps API 在网站上创建带有坐标的地图。 我不知道如何在标记上添加相同的红色标签,以便在 Google 地图上进行搜索。
For example with the Eiffel Tower
我尝试使用title 选项,但是当我点击标记时它只显示一个标签。
【问题讨论】:
标签: javascript google-maps google-maps-api-3
function initMap() {
var myLatLng = {lat: -25.363, lng: 131.044};
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: myLatLng
});
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: 'Hello World!'
});
google.maps.event.addListener(marker, 'click', () => {
infoWindow = new google.maps.InfoWindow({content: "This is DC!"})
infoWindow.open(map, marker)
})
}
【讨论】: