我想知道如何在div中显示地图外的标记信息(在Onclick之后),而不是在标准的Google地图信息窗口中显示它。
答案 0 :(得分:2)
基本上你需要为该标记注册和事件监听器......所以当用户点击它时会触发一个函数。
marker = new google.maps.Marker({
map:map,
draggable:true,
animation: google.maps.Animation.DROP,
position: parliament
});
google.maps.event.addListener(marker, 'click', showInfo);
function showInfo() {
//display info whereever you like.
}
P.S。这只是示例代码,因此您需要根据自己的需要进行调整。
希望这有帮助