0
我正在嘗試將一個mouseover事件偵聽器添加到Google Maps覆蓋圖視圖。我一直在following this question,但不能讓聽衆工作。這是我的代碼:在Google Maps V3中製作OverlayView可點擊
InfoWindow.prototype = new google.maps.OverlayView;
InfoWindow.prototype.onAdd = function() {
this.getPanes().overlayMouseTarget.appendChild(this.$content.get(0));
this.getPanes().overlayMouseTarget.parentNode.style.zIndex = 100000;
google.maps.event.addListener(this, 'mouseover', function() {
console.log('MOUSEOVER');
});
};
這不會給出任何錯誤,但也不會對mouseover做任何事情。我也試過使用this.listeners
:
this.listeners = [
google.maps.event.addDomListener(this, "mouseover", function (e) {
console.log('MOUSEOVER');
})
];
但它也沒有幫助。我究竟做錯了什麼?