1

How to detect infowindow closed in jquery-ui-map and pan the map to center after the window is closed ?

<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>
ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
andy
  • 177
  • 2
  • 12

1 Answers1

1

Google Maps Infowindows have a closeclick event. You can attach a listener to this event for every info window and pan the map when you receive a notification for this event. A basic example for this is given in this posting.

Community
  • 1
  • 1
j0nes
  • 8,041
  • 3
  • 37
  • 40