Question

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>
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top