2012-09-12 40 views
0

如何檢測在jquery-ui-map中關閉的infowindow並在窗口關閉後將地圖平移到中心?jquery-ui-map檢測infowindow關閉並平移到地圖中心

<pre> 

$(function() { 
       demo.add(function() { 
        $('#themap').gmap({'center': '54.977614,23.871643', 'zoom': 7,'disableDefaultUI':false, 'callback': function() { 
         var self = this; 
         $.getJSON('index.php?option=com_maps&view=stendai&format=json', function(data) { 
          $.each(data.markers, function(i, marker) { 
           self.addMarker({ 'id':marker.id, 'position': new google.maps.LatLng(marker.latitude, marker.longitude),'icon':'images/stendas.png' , 'bounds':true } 



           ).click(function() { 
            self.openInfoWindow({ 'content': marker.content }, this); 
           }); 

          }); 
         }); 
        }}); 
       }).load(); 
      }); 


</pre> 

回答

1

谷歌地圖Infowindows有一個closeclick事件。您可以爲每個信息窗口的此事件附加偵聽器,並在收到此事件的通知時平移地圖。 this posting給出了一個基本的例子。

相關問題