google maps 一次只開一個 infowindow

再開啟的時候把其他的 infowindow 移除就好了。

  1. google.maps.event.addListener(marker, 'click'function() {   
  2.     if($('.gm-style-iw').length) {   
  3.          $('.gm-style-iw').parent().remove();   
  4.     }   
  5.     infowindow.open(map,marker);   
  6. });  

留言