如何用Jquery&amp ;;显示div中的信息谷歌地图v3

时间:2011-06-27 09:58:31

标签: jquery google-maps google-maps-api-3

我想知道如何在div中显示地图外的标记信息(在Onclick之后),而不是在标准的Google地图信息窗口中显示它。

1 个答案:

答案 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。这只是示例代码,因此您需要根据自己的需要进行调整。

希望这有帮助