显示谷歌地图侧窗信息

时间:2018-02-20 22:43:29

标签: javascript html google-maps

如何在我的网站上显示谷歌地图侧窗信息? 这就是它现在在我的网站上显示的内容:

https://i.gyazo.com/9030cb7eae84da77ff0e8f70d917e6d3.png

但这就是我想要的:

https://i.gyazo.com/c7e74ca2ca0b8350daa4616fdabba34e.png

我正在使用此代码,它只是用标记显示位置:

function showGoogleMaps() {
if (document.getElementById("GPMAP").value == "test1"){

}
if (document.getElementById("GPMAP").value == "test2"){
var position = [52.077488, 4.262157];
}
if (document.getElementById("GPMAP").value == "test3"){
var position = [52.073351, -1.014658];
}
if (document.getElementById("GPMAP").value == "test4"){
var position = [22.077488, 4.262157];
}
var latLng = new google.maps.LatLng(position[0], position[1]);

var mapOptions = {
    zoom: 16, // initialize zoom level - the max value is 21
    streetViewControl: false, // hide the yellow Street View pegman
    scaleControl: true, // allow users to zoom the Google Map
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    center: latLng
};

map = new google.maps.Map(document.getElementById('googlemaps'),
    mapOptions);

// Show the default red marker at the location
marker = new google.maps.Marker({
    position: latLng,
    map: map,
    draggable: false,
    animation: google.maps.Animation.DROP
});
}

那么如何显示包含所有评论和照片等的侧窗?

0 个答案:

没有答案