2014-07-04 78 views
-1

我想在谷歌地圖標記信息窗口上設置一些顯示/隱藏動作。我這樣做是通過mouseovermouseout事件,但我已經使用jQuery所以有些衝突......,代碼:谷歌地圖信息窗口顯示/隱藏動作

newmarker['infowindow'] = new google.maps.InfoWindow({ 
    content: html 
}); 

google.maps.event.on(newmarker, { 
    mouseover : function(){ 
     this['infowindow'].open(map, this) 
    }, 
    mouseout : function() { 
     this['infowindow'].close(map, this) 
    } 
}); 

有人能幫忙嗎?

+0

它的工作或沒有? – cracker

回答

2

嘗試像

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

// assuming you also want to hide the infowindow when user mouses-out 
google.maps.event.addListener(marker, 'mouseout', function() { 
    infowindow.close(); 
}); 

Demo

Demo1

+0

好的,但如何將其設置爲一個事件監聽器? – Lukas

+0

你可以直接使用它 – cracker

+0

thx尋求幫助,它的工作完美,對不起,但沒有反應,但只是2天我看到它 – Lukas