Marker

Marker

參考資料:(https://developers.google.com/maps/documentation/javascript/markers?hl=zh-tw)

各種事件

'click' 'dblclick' 'mouseup' 'mousedown' 'mouseover' 'mouseout'

要註冊事件,請使用 addListener()

addListener()

規則

addDomListener(instance:Object, eventName:string, handler:Function)

範例1

marker.addListener('click', aFunction);

範例2

google.maps.event.addListener(marker, 'mouseover', function () { infowindow2.open(map, marker);});

建立marker物件

var marker = new google.maps.Marker({
    position: uluru,
    map: map,
    title: 'Uluru (Ayers Rock)'
});

刪除marker物件

marker.setMap(null);

Last updated